Copy-swap idiom [C++]
stackoverflow.com