
AMDG Marco Costalba wrote:
To disambiguate between the two a SFINAE technique is used on the second (hidden) argument of "set"
Where struct is_compatible is defined as:
/* Check if a function/functor Fun has a given signature Sig */
template<typename Fun, typename Sig> struct is_compatible { /* Check for a function */ template<class U> static yes_type check(typename enable_if<is_same<U, Sig> >::type*);
/* Check for a functor */ template<class U, Sig U::*> struct helper;
template<class U> static yes_type check(helper<U, &U::operator()>*);
This is not correct. It does not handle struct f { void operator()() *const* {} }; Further, it cannot handle implicit conversions of the argument types and return types.
/* Default */ template<class U> static no_type check(...);
typedef typename boost::remove_pointer<Fun>::type F;
static bool const value = (sizeof(check<F>(0)) == sizeof(yes_type)); };
In Christ, Steven Watanabe