|
Boost Users : |
Subject: [Boost-users] How to deduce (possibly void) return type of member function?
From: Terry Golubiewski (tjgolubi_at_[hidden])
Date: 2010-05-22 10:53:58
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net