
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=%3c31f5f6790806231544h1ec89cd...)
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