Boost logo

Boost Users :

Subject: Re: [Boost-users] [Signals\Signals2] Move semantics
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-08-29 18:33:42


on Mon Aug 29 2011, Christopher Jefferson <chris-AT-bubblescope.net> wrote:

> On 29 Aug 2011, at 14:04, Szymon Gatner wrote:
>
>> 2011/8/27 Dave Abrahams <dave_at_[hidden]>:
>>>
>>> No, it's the easiest way to get move assignment semantically correct,
>>> but not "the preferred way." At least, it's not universally preferred.
>>> See http://cpp-next.com/archive/2009/09/your-next-assignment/>>
>>
>> Thanks, great read! I am still trying to fully understand all implications of
>> move semantics. For example: is std/boost::move() killer of potential RVO?
>>
>> I mean:
>>
>> std::vector<int> getNumbers()
>> {
>> std::vector<int> ret;
>>
>> // fill data
>>
>> return move(ret) // will that kill potential (N)RVO?
>> }
>
> std::move does not hurt RVO in compilers I have tried it
> in. boost::move, when emulating move semantics in C++03, does seem to
> confuse RVO in some situations (sorry if that is a bit vague, I did
> not do a full and complete investigation).

Also note: C++11 inserts the move there implicitly, so you never need to
write "return move(...)"

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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