|
Boost : |
Subject: Re: [boost] [move][container] Review Request (new versions of Boost.Move and Boost.Container in sandbox and vault)
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-08-12 07:15:31
David Abrahams escribió:
> Very great news to hear that this project is moving forward (so to speak
> ;-))
Let's hope this is the final step!
>> The library has now new macros to declare copyable and movable types and movable only
>> types. Old macros are still there for backwards compatibility (specially unordered
>> library which was also ported to this move sandbox) but I expect to remove them if
>> current approach is considered better.
>>
>> ->Updated documentation and tests.
>
> http://svn.boost.org/svn/boost/sandbox/move/libs/move/doc/html/move/composition_inheritance.html
>
> still says "all moves occur explicitly," but I think you mean "all moves
> from lvalues," right?
Yes. The new library now moves non-const rvalues in assignments:
copyable_and_movable produce();
copyable_and_movable cm;
for(;;){
//now moved instead of copied!
cm = produce();
}
This is not the case with constructors (the original Klaus Triendl
proposal included them,
http://lists.boost.org/Archives/boost/2009/06/153266.php) because it
terribly uglifies syntax (there is no way in C++03 to automatically
generate constructor overloads that forward to another constructor) and
because that case is in practice more efficient than moving thanks to RVO:
for(;;){
//Copied? No, RVO avoids copy
copyable_and_movable cm = produce();
}
Best,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk