
Michael Marcin: ...
T& operator=(T arg) { arg.swap(*this); return *this; }
...
It also allows you to support move assignment emulation rather elegantly using the move library in the sandbox.
There is no need to use a move library. The point of the above assignment is to take advantage of copy elision, which allows the compiler to construct the rvalue argument directly into 'arg', without a copy. In other words, if you have T t; T f(); int main() { t = f(); } the return value of f() can be constructed into 'arg', producing the equivalent of f().swap(t); If, in addition, the compiler implements RVO and f() is written in an RVO-friendly way, there will be no copies at all. (I'm sure that this is explained well in the clc++m thread, which I apologize for not having read.)