templates - In C++, how can I get an arbitrary function's type from its declaration? -
possible duplicate:
extract return type of function without calling (using templates?)
starting (provided else):
int my_function(int, int *, double);
i want 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 my_function_type
?
note: know boost_typeof()
, seems bit scary, in "perhaps not totally portable"?
decltype
. examples:
char foo(int) {} decltype (foo(3)) const *frob = "hello foo"; typedef decltype (foo(3)) typeof_foo; using typeof_foo = decltype(foo(3));
the expression decltype
evaluated @ compile time , must resolvable. pass constexpr
integer it.
Comments
Post a Comment