Boost logo

Boost :

Subject: Re: [boost] Improving the assignment operators of various Boosttypes
From: David Abrahams (dave_at_[hidden])
Date: 2008-09-10 15:34:08


on Wed Sep 10 2008, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:

> Michael Marcin:
> ...
>> For rvalues yes but for lvalues you need move emulation. Which can be
>> implemented in the sandbox move library as follows.
>>
>> class foo
>> {
>> public:
>> foo();
>> foo( T t );
>> foo( boost::move_from<foo> other )
>> {
>> swap( other.source );
>> }
>>
>> foo& operator=( foo rhs )
>> {
>> swap( rhs );
>> }
>
> I see what you mean now, thanks. This is, I believe, the Adobe approach for move
> emulation:
>
> http://stlab.adobe.com/group__move__related.html
>
> It's based on the Adobe/Stepanov philosophy that all types are copyable, so it
> doesn't support move-only types.

Yes, that's the basis, but adding handling for move-only types is pretty
easy
(http://news.gmane.org/find-root.php?message_id=%3c31f5f6790806231544h1ec89cdw99315be2ef202e80%40mail.gmail.com%3e)

> This takes away one motivation for having move. std::vector won't use
> adobe::move/boost::move, so this takes away the other
> motivation. What's left? :-)

boost/interprocess/containers/vector.hpp et. al.

-- 
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