
10 Sep
2008
10 Sep
'08
5:53 p.m.
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? :-)