Boost logo

Boost :

Subject: Re: [boost] [Phoenix-3] Is Actor assignable?
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-01-22 11:01:01


Joel de Guzman wrote:

<snip>
>>>>>>>
>>>>>>> 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.
<snip>
>>
>> Seems like i don't stand a chance. I was trying to find a use case where
>> you might want the lazy version of the assignment ... couldn't find one.
>> Added the operator=(actor const&) to phoenix 3.
>>
>> Thanks for the hint.
>
> But here's where it gets tricky: Even a slight change in type
> will make it lazy. Consider a: value<int> b: value<short>.

Ok ... we can't detect this (probably) in any sane manner.
And it is not needed to fulfill the Assignable requirement.


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