|
Boost : |
Subject: Re: [boost] Improving the assignment operators of various Boosttypes
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-09-10 13:53:47
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. 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 list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk