Should the Copy-and-Swap Idiom become the Copy-and-Move Idiom in C++11?
First of all, it is generally unnecessary to write a swap function in C++11 as long as your class is movable. The default swap will resort to moves: void swap(T& left, T& right) { T tmp(std::move(left)); left = std::move(right); right = std::move(tmp); } And that’s it, the elements are swapped. Second, based on this, the … Read more