
On 7/5/2010 8:53 PM, Daniel Walker wrote:
Also, another thought, if the call operators on your function objects are not overloaded, you can do something like the following without having to know the signature.
template<typename Functor, typename CallOperator> void f(const Functor&f, CallOperator) { using boost::function_types::parameter_types; using boost::function_types::function_arity;
typedef typename parameter_types<CallOperator>::type params; // an mpl sequence const std::size_t arity = function_arity<CallOperator>::value; // ... }
struct F { void operator()(int) {} };
int main() { f(F(),&F::operator()); }
That's a nice trick, thanks! I might be able to use that for the general case. Unfortunately a bind expression seems to have tens of overloads :( Kind regards, Edd