22 May
2010
22 May
'10
2:53 p.m.
If I have a class... struct X { int f(double x); void f(int y); }; ... and a template Y that wants to deduce the return-type of some member functions of T... template<class T> struct Y { typedef typename what_goes_here<T>::type f_double_return_type; typedef typename what_goes here<T>::type f_int_return_type; }; I"ve tried using... typedef BOOST_TYPEOF_TPL(static_cast<X*>(0)->f(double(0))) f_double_type; // this works ... but ... typedef BOOST_TYPEOF_TPL(static_cast<X*>(0)->f(int(0)) f_int_type; // does not work for "void" Of course, I wouldn't know which one returns "void" or not ahead of time. terry