
10 Oct
2008
10 Oct
'08
9:19 p.m.
AMDG Michael Marcin wrote:
I want to take a boost::bind functor and get the type of its arguments.
I can't find any sort of introspection api documented. I tried using mpl but what I came up with doesn't seem to work.
Is there a way to do this?
It isn't possible in general, because function objects created with bind are polymorphic. #include <boost/bind.hpp> struct F { typedef void result_type; template<class T> void operator()(const T&) const {} }; template<class F> void call(const F& f) { f(1); f("test"); } int main() { call(boost::bind(F(), _1)); } In Christ, Steven Watanabe