
I can't seem to get the result_of template to function, I've tried: #include <boost/utility/result_of.hpp> typedef boost::result_of<F>::type t; with F= int (double) int (*)(double) int (&)(double) std::unary_function<double,int> and all give a long list of errors. I believe that all of these should be OK? So am I doing something obvious wrong (I'm using VC7.1 BTW in case that makes a difference)? Thanks, John.

John Maddock wrote:
I can't seem to get the result_of template to function, I've tried:
#include <boost/utility/result_of.hpp>
typedef boost::result_of<F>::type t;
with F=
int (double) int (*)(double) int (&)(double) std::unary_function<double,int>
and all give a long list of errors.
I believe that all of these should be OK? So am I doing something obvious wrong (I'm using VC7.1 BTW in case that makes a difference)?
Yes. int(double) means call an object of type int with one argument of type double. You need result_of<F(A)>, where F is as above, and A is the argument type.

Yes.
int(double) means call an object of type int with one argument of type double.
You need result_of<F(A)>, where F is as above, and A is the argument type.
Thanks, I kind of figured that out eventually, I understand why it's done that way, but it wasn't obvious from the docs - or not late last yesterday afternoon anyway ;-) BTW, do you have any plans to apply result_of to reference_wrapper to make TR1 conforming (only if the compiler can cope obviously)? Many thanks, John.

John Maddock wrote:
Yes.
int(double) means call an object of type int with one argument of type double.
You need result_of<F(A)>, where F is as above, and A is the argument type.
Thanks, I kind of figured that out eventually, I understand why it's done that way, but it wasn't obvious from the docs - or not late last yesterday afternoon anyway ;-)
BTW, do you have any plans to apply result_of to reference_wrapper to make TR1 conforming (only if the compiler can cope obviously)?
I was going to play my usual "dependencies" tune, but it seems that boost/ref.hpp is already entangled in the MPL web, and indirectly, via addressof.hpp, in the type_traits web (only on MSVC 7.0, but bcp.exe doesn't know that, and neither will most of the users.) Maybe I should just give up. Then again, maybe not. I always get asked how can one separate bind and/or shared_ptr from the rest of Boost. Must be a social circle thing. It would be easy to untangle boost/utility/addressof.hpp; it only includes add_pointer.hpp as part of a bug workaround by Dave Abrahams. Dave, do you remember the code that triggers the bug so we can add it to addressof_test.cpp?

"Peter Dimov" <pdimov@mmltd.net> writes:
It would be easy to untangle boost/utility/addressof.hpp; it only includes add_pointer.hpp as part of a bug workaround by Dave Abrahams. Dave, do you remember the code that triggers the bug so we can add it to addressof_test.cpp?
I'm afraid I have no memory of ever hacking in addressof. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
David Abrahams
-
John Maddock
-
Peter Dimov