//Purpose: // Prototype the can_be_called method here: /* http://www.boost.org/doc/libs/1_41_0/doc/html/proto/appendices.html#boost_proto.appendices.implementation.function_arity */ #include #include struct dont_care { dont_care(...); }; struct private_type { private_type const &operator,(int) const; }; typedef char yes_type; // sizeof(yes_type) == 1 typedef char (&no_type)[2]; // sizeof(no_type) == 2 template no_type is_private_type(T const &); yes_type is_private_type(private_type const &); template struct funwrap_dont_care ; template struct funwrap_dont_care : funwrap_dont_care { }; template struct funwrap_dont_care : Fun { funwrap_dont_care(); typedef private_type const &(*pointer_to_function)(Args...); operator pointer_to_function() const; }; template struct at_type_value ; template struct at_type_value<0, boost::mpl::package > { typedef Head type; static type value(void); }; template struct at_type_value > : at_type_value > { }; template struct can_be_called_impl ; template struct can_be_called_impl, Args> { static unsigned const arity=sizeof...(Indices); static funwrap_dont_care &fun; static bool const value = ( sizeof(no_type) == sizeof(is_private_type( (fun(at_type_value::value()...), 0) )) ); typedef boost::mpl::bool_ type; }; template struct can_be_called : can_be_called_impl < Fun , typename boost::mpl::package_range_c < unsigned , 0 , sizeof...(Args) >::type , boost::mpl::package > { };