namespace boost{ namespace container{ namespace detail{ namespace has_member_function_callable_with { struct dont_care { dont_care(...); }; struct private_type { static private_type p; private_type const &operator,(int) const; }; typedef char yes_type; typedef char (&no_type)[2]; template no_type is_private_type(T const &); yes_type is_private_type(private_type const &); }}}} namespace boost{ namespace container{ namespace detail{ template class has_member_function_named_func { struct BaseMixin { void func(); }; struct Base : public Type, public BaseMixin {}; template class Helper{}; template static has_member_function_callable_with::no_type deduce (U*, Helper* = 0); static has_member_function_callable_with::yes_type deduce(...); public: static const bool value = sizeof(has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0))); }; template struct has_member_function_callable_with_func_impl; template struct has_member_function_callable_with_func_impl { static const bool value = false; }; }}} namespace boost{ namespace container{ namespace detail{ template struct funwrap1_func: Fun { using Fun::func; has_member_function_callable_with::private_type func( has_member_function_callable_with::dont_care); }; template struct has_member_function_callable_with_func_impl { static funwrap1_func &fun; static P0 & p0; static bool const value = (sizeof(has_member_function_callable_with::no_type) == sizeof(has_member_function_callable_with::is_private_type ( (fun.func( p0 ), 0) ) ) ); }; }}} namespace boost{ namespace container{ namespace detail{ template struct funwrap2_func: Fun { using Fun::func; has_member_function_callable_with::private_type func( has_member_function_callable_with::dont_care , has_member_function_callable_with::dont_care); }; template struct has_member_function_callable_with_func_impl { static funwrap2_func &fun; static P0 & p0; static P1 & p1; static bool const value = (sizeof(has_member_function_callable_with::no_type) == sizeof(has_member_function_callable_with::is_private_type ( (fun.func( p0 , p1 ), 0) ) ) ); }; }}} namespace boost{ namespace container{ namespace detail{ template struct funwrap3_func: Fun { using Fun::func; has_member_function_callable_with::private_type func( has_member_function_callable_with::dont_care , has_member_function_callable_with::dont_care , has_member_function_callable_with::dont_care); }; template struct has_member_function_callable_with_func_impl { static funwrap3_func &fun; static P0 & p0; static P1 & p1; static P2 & p2; static bool const value = (sizeof(has_member_function_callable_with::no_type) == sizeof(has_member_function_callable_with::is_private_type ( (fun.func( p0 , p1 , p2 ), 0) ) ) ); }; template struct has_member_function_callable_with_func : public has_member_function_callable_with_func_impl ::value, Arg , P0 , P1 > {}; }}} struct functor { void func(const int&); void func(const int&, const int&); void func(const int&, const int&, const int&); }; struct functor2 { void func(char*); void func(int, char*); void func(int, char*, double); void func(const int&, char*, void *); }; struct functor3 { }; struct functor4 { template void func(int, const T &); template void func(const T &); template void func(int, const T &, const U &); }; int main() { using namespace boost::container::detail; { int check1[ has_member_function_callable_with_func::value ? 1 : -1]; int check2[!has_member_function_callable_with_func::value ? 1 : -1]; int check3[!has_member_function_callable_with_func::value ? 1 : -1]; int check4[ has_member_function_callable_with_func::value ? 1 : -1]; int check5[!has_member_function_callable_with_func::value ? 1 : -1]; int check6[!has_member_function_callable_with_func::value ? 1 : -1]; int check7[ has_member_function_callable_with_func::value ? 1 : -1]; int check8[ has_member_function_callable_with_func::value ? 1 : -1]; } { int check1[ has_member_function_callable_with_func::value ? 1 : -1]; int check2[!has_member_function_callable_with_func::value ? 1 : -1]; int check3[!has_member_function_callable_with_func::value ? 1 : -1]; int check4[ has_member_function_callable_with_func::value ? 1 : -1]; int check5[!has_member_function_callable_with_func::value ? 1 : -1]; int check6[!has_member_function_callable_with_func::value ? 1 : -1]; int check7[ has_member_function_callable_with_func::value ? 1 : -1]; } { int check1[ has_member_function_callable_with_func::value ? 1 : -1]; int check2[!has_member_function_callable_with_func::value ? 1 : -1]; int check3[!has_member_function_callable_with_func::value ? 1 : -1]; int check4[ has_member_function_callable_with_func::value ? 1 : -1]; int check5[!has_member_function_callable_with_func::value ? 1 : -1]; int check6[!has_member_function_callable_with_func::value ? 1 : -1]; int check7[ has_member_function_callable_with_func::value ? 1 : -1]; } return 0; }