|
Boost : |
From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2008-05-09 12:35:21
Hello,
With all the recent discussion about result_of and now that decltype
has started to trickle into compilers, I thought it might be a good
time for Boost to provide a result_of along the lines of the
typeof-based implementation described in N1454. I've attached a patch
to Ticket #862, which does this.
http://svn.boost.org/trac/boost/ticket/862
This is an old bug report that apparently got a little mangled during
the SVN migration, but I think result_of/lambda compatibility is a
familiar problem. My patch fixes the problem of using result_of with
lambda on compilers that support decltype. It does not preclude fixes
to the problem on C++03 platforms, such as Shunsuke Sogame's Egg and
Marco Costalba's multi-signature function, for example. It also makes
boost::result_of more compliant with the current C++0x std::result_of
described in N2588.
My patch differs from N2588 in that std::result_of only supports
function call expressions of the form f(x). I read this as precluding
support for member function pointers, which are invoked with
expressions of the form o->*f(x). My patch reuses the pointer
specialization from the current implementation, so that
boost::result_of can continue support both. It also may differ from
N2588 in terms of the lvalue/rvalue specifications. I'm not sure that
I understand this correctly, and I would be grateful if someone would
look over it to see if my implementation should be changed for better
conformance.
The patch also includes updates to the documentation and tests. I
tested with msvc 9, gcc 3.4, and gcc 4.3. Thanks for your
consideration!
Daniel Walker
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk