Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-07-02 14:40:14

David Abrahams wrote:
> Eric Niebler wrote:
>> David Abrahams 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
>> 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. In C++0x, result_of will simply use
decltype, so at the very least Phoenix's approach is forward-compatible.

Eric Niebler
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at