Boost logo

Boost Users :

Subject: Re: [Boost-users] [container] Initialization from transformed_range compilation error
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-09-07 15:58:10


El 07/09/2011 17:40, Szymon Gatner escribió:
> 2011/9/7 Ion Gaztañaga<igaztanaga_at_[hidden]>:
>> El 07/09/2011 0:05, Szymon Gatner escribió:
>>
>> It's moved, this feature produces the limitation (must define
>> copy-constructor for copyable types owning copyable and movables classes
>> like boost::container::vector) that Daniel has suffered. Example:
>>
>
> It is still not clear to me. What is moved and in under what conditions?
>
> Let me clarify me question: will this move or copy:
>
> boost::container::vector<int> makeInts()
> {
> boost::container::vector<int> ret;
> //....
> return ret;
> }
>
> boost::container::vector<int> ints;
>
> ints = makeInts()<========= move or copy?

Depending on the compiler, move or copy (Named return value optimization
is not so friendly with emulated move semantics). If you want to be
really sure, use return ::boost:move(ret);

Best,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net