2013/7/30 Marc Glisse
On Mon, 29 Jul 2013, Joseph Gauterin wrote:
Given a user define types that specializes std::swap but isn't moveable (a
reasonable scenario for C++03 code still being compiled with a C++03 compiler), wouldn't this change result in 3 copies instead of a single call to the specialized std:swap?
The recommended way is to overload swap for your type, not specialize std::swap. As long as that case still works, the rest might be acceptable...
I'd rather spend a few more days thinking of some other solutions. Silently breaking user code to make some c++11-emulation-for-old-compilers work out of the box is not good. Is there a better idea than specializing the boost::swap for ::boost::rv<T> types and forcing users to write `boost::swap(boost::move(object1), boost::move(object2));` ? -- Best regards, Antony Polukhin