
On Fri, Sep 18, 2009 at 8:37 AM, veerus <veeranjaneyulu.sadhanala@ms.com> wrote:
How to extract the return type and the argument type list from the type Signature in boost::function<Signature> ?
More specifically if I have a object of type boost::function< int ( double)
, the thing "int (double)" is matched with a type. What type is that ? Where can I find it?
Sounds like same thing I ran into. Is this what you are looking for: // for some reason boost::function_types does not handle boost::functions, // nor does boost::function have a function::signature typedef, // so in order to support boost, we use this signature<F>::type mechanism: template <typename F> struct signature { typedef F type; }; // specialize for boost::function template <typename F> struct signature<boost::function<F> > { typedef F type; }; template <typename F> struct result_type { typedef typename boost::function_types::result_type<typename signature<F>::type>::type type; }; So signature<F>::type returns (for example) 'int (double)' for normal functions as well as boost functions similarly, result_type<F>::type returns 'int' Tony