What is the copy-and-swap idiom and when should it be used? What problems does it solve? Does it change for C++11? Related: What are your favorite C++ Coding Style idioms: Copy-swap Copy constructor and = operator overload in C++: is a common function possible? What is copy elision and how it optimizes copy-and-swap idiom C++: dynamically allocating an array of objects?