|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-11-26 06:35:21
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk