
Eric Niebler wrote:
David Abrahams wrote:
Eric Niebler wrote:
Eric Niebler wrote:
The Phoenix/Proto port in (Phoenix v3) uses BOOST_TYPEOF to deduce the the type of expressions involving operators, with the exception of the function call operator. For the function call operator, Phoenix v3 uses result_of to calculate the return type. Interesting. Kinda makes sense, but could you explain the rationale anyway? You mean, the rationale for using result_of instead of BOOST_TYPEOF for
David Abrahams wrote: the function call operator? BOOST_TYPEOF can't perfectly distinguish between lvalues and rvalues. I fudge it where I have to, but with function calls no fudging is necessary because result_of presumably gives the right answer.
Assuming it's implemented, yeah. It might be nice to be able to fudge when it isn't :-)
I don't know a sufficiently portable way to ask a type whether it has implemented the result_of protocol.
Me niether. Too bad (?) result_of wasn't designed with that in mind :(
In C++0x, result_of will simply use decltype, so at the very least Phoenix's approach is forward-compatible.
Sounds like about the best we can do. -- Dave Abrahams BoostPro Computing http://www.boostpro.com