
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