
26 Nov
2007
26 Nov
'07
11:35 a.m.
Hi, What happens if result_of is not consistent with decltype? struct my_fun_t { template<class Sig> struct result; template<class This> struct result<This(int)> { typedef int type; // avoid dangling. }; template<class This> struct result<This(int const &)> { typedef int const & type; }; int const & operator()(int const &i) const { return i; } }; my_fun_t const my_fun = {}; int main() { boost::result_of<my_fun_t const(int)>::type x = my_fun(10); // ok in C++98. decltype(my_fun(10)) x_ = my_fun(10); // dangling in C++0x. } BTW, result_of implementation of my_fun_t is allowed in C++98? Regards, -- Shunsuke Sogame