Search code examples
boostboost-function

Is it possible to find the return type of a boost::function from it's typedef?


Is it possible to find the return type of a boost::function purely from its typedef?

Example:

typedef boost::function<bool (int, float)> CallbackType1;
typedef boost::function<float (int, float)> CallbackType2;

How to find the return type of the above function types?

I'm not sure if using c++0x features will be possible in my target build system, but any solution is welcome.

Many Thanks Guys,
Sak


Solution

  • Boost.Function has a typedef inside it called return_type that should do the trick:

    typedef CallbackType1::result_type CallbackType1ReturnType;
    

    No wizardry needed.