Boost logo

Boost :

Subject: Re: [boost] phoenix::bind
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-09-30 07:58:20


On Tue, Sep 30, 2008 at 3:57 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Eric Niebler wrote:
>>>
>>> The other thorny issue is that lambda expressions aren't Assignable,
>>> because their operator= creates a new lambda exression instead. This might
>>> well be unfixable.
>>
>> We could make lambdas Assignable by defining the ordinary assignment
>> operator when the rhs has the same type as the lhs. That would rule out
>> strange lambdas like "_1 = _1" , but I don't see that as a huge loss.
>
> what about a nullary lambda:
>
> vector<int> v1, v2;
>
> (ref(v1) = ref(v2))();
>

If phoenix required every lambda to be 'fenced' with lambda[] or
something simlar, operator= would be a non problem: all the parts of a
lambda would overload operator= to return an expression template,
except for the function object returned by lambda[], which would be a
plain function object (plus I guess extra facilities to set the
internal local variables).

The same is also true for operator&.

-- 
gpd

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