Possible Duplicate:
Extract the return type of a function without calling it (using templates?)
Starting with this (provided by somebody else):
int my_function(int, int *, double);
I want to get to this:
typedef boost::function_types::result_type< my_function_type >::type my_result;
typedef boost::function_types::parameter_types< my_function_type >::type my_parameters;
How do I get my_function_type?
NOTE: I know about BOOST_TYPEOF(), but it seems a bit scary, as in “perhaps not totally portable”?
decltype. Examples:The expression to
decltypeis evaluated at compile time and thus must be resolvable. You could pass anyconstexprinteger to it.