
1 Mar
2005
1 Mar
'05
8:16 p.m.
"Jonathan Turkanis" <technews@kangaroologic.com> wrote
Because the type expression passed to result_of must be of the form F(arg1, ..., argN).
The correct way to use result_of with function pointers is as follows:
[original example snip] This also works : #include <boost/static_assert.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/utility/result_of.hpp> typedef int (*f)(int); // <-- no change int main() { typedef boost::result_of<f(double,bool,long,char,int)>::type result_type1; typedef boost::result_of<f()>::type result_type2; BOOST_STATIC_ASSERT((boost::is_same<result_type1, result_type2>::value)); } IOW the args are 'sugar' in the function pointer/ref case. regards Andy Little