C++ move semantics and the copy-swap idiom

Following the Resource Allocation Is Initialization technique, the copy-swap idiom for assigning the contents of one object to another may be the next-richest wisdom-in-a-nutshell technique. It’s a great way to learn about the “move semantics” introduced in C++0x (aka the update to the language that was expected to be delivered before 2010 but was actually a little late).

Print Friendly, PDF & Email