Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-07-01 12:39:36


On Tue, Jul 1, 2008 at 5:39 PM, Eric Niebler <eric_at_[hidden]> wrote:
> Giovanni Piero Deretta wrote:
>>
>> - What are exactly the quirks that makes it hard to have full backward
>> compatibility? Well except for 'sig' of course.
>
> Wish I had written them all down. One that sticks in my mind is whether
> variables are captured by value or by reference. With Phoenix, it's very
> consistent ... all variables are captured by value, always. Lambda tries to
> be a bit more helpful, and it makes the rules more confusing, IMO. Most of
> the time, variables are captured by value, but a variable on the left of an
> assignment is captured by reference. This includes all the assignment
> operators, like plus-assign. So the following is a valid lambda expression:
>
> int i = 0;
> i += _1;
>
> But in Phoenix, it would have to be:
>
> int i = 0;
> ref(i) += _1;
>

D'uh, I didn't know boost.lambda did that! I always stick a ref() in
these cases. The only "help" that lambda provided, that I knew of, was
with 'cout' (and similar) and array types. So this won't affect me at
least.

-- 
gpd

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk