Boost logo

Boost :

Subject: Re: [boost] [variant] Please vote for behavior
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-01-31 15:17:44


on Thu Jan 31 2013, Paul Smith <pl.smith.mail-AT-gmail.com> wrote:

> On Thu, Jan 31, 2013 at 9:24 AM, Antony Polukhin <antoshkka_at_[hidden]> wrote:
>> From theoretical point of view you are absolutely correct, and my
>> example is lame. Moreover, current implementation of move assignment
>> and move constructors for recursive_wrapper were implemented to model
>> that behavior.
>
> Just pointing out that move assignment is not affected by this
> discussion. Everything is already allocated so it's as efficient as a
> pointer swap.

Actually the correct semantics of move assignment is the same as "swap +
clear" if there's an empty state. See
http://cpp-next.com/archive/2009/09/your-next-assignment/

I recommend reading the whole article.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

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