Boost logo

Boost :

Subject: Re: [boost] [Phoenix-3] Is Actor assignable?
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-01-22 08:07:06


On 1/22/2011 9:02 PM, Joel de Guzman wrote:
> On 1/22/2011 8:17 PM, Thomas Heller wrote:
>> Joel de Guzman wrote:
>>
>>> On 1/21/2011 8:39 PM, Michel MORIN wrote:
>>>> I have another question about Phoenix 3.
>>>> Is the copy assignment of Actors no-op, or does it really copy the
>>>> contents?
>>>>
>>>> Actor a;
>>>> Actor b = ...;
>>>> a = b; // no-op?
>>>
>>> It should copy the contents. Thomas?
>>
>> Not really. It needs to create the assign actor (that means the expression
>> template representing the assignment operation.
>> It is neither a no-op nor is the assignment "executed". Remember the stuff
>> about phoenix being lazy ;)?
>
> No! That's not the case here. There *is* still the immediate assignment
> operator being called when two actors are of the same type (e.g.
> when lhs and rhs are phoenix values). In these cases, a *is*
> assigned to *b*. Thus, for values, the contents are copied.
> Ditto for copy construction of course.

Oops, I meant b is assigned to a of course :-P

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com

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