Boost logo

Boost :

Subject: Re: [boost] [move] Library uploaded to sandbox
From: David Abrahams (dave_at_[hidden])
Date: 2009-02-18 12:35:14


on Wed Feb 18 2009, Ion Gaztañaga <igaztanaga-AT-gmail.com> wrote:

> Olaf Peter wrote:
>> Hi Ion,
>>
>>> I've uploaded a new version of the move emulation library to sandbox.
>>> I've put it temporarily in "move_semantics" folder to avoid overwriting
>>> current move code.
>>
>> what is the differnet to Adobe's move library
>> (http://stlab.adobe.com/group__move__related.html) ??
>
> The emulation is different because Adobe's library "move" returns T:
>
> T move(T &t);
>
> This library (credits to David Abrahams)

Really, that was *my* idea?

> returns a pseudo-rvalue reference:
>
> boost::rv<T> & move(T &t);
>
> so there is a way to implement forwarding without any intermediate copy or move and to
> modify the original value instead of creating a temporary one. For example Adobe.Move
> containers need to implement push_back by value:
>
> push_back(T t);

...which they can do because they assume the existence of a swap for T.
That's the classic "sink function" pattern, which "moves" from rvalues
by relying on copy elision.

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

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