5,337
edits
(→RAII) |
|||
Line 571: | Line 571: | ||
* Move constructor (since C++11, for <code>std::move</code>) | * Move constructor (since C++11, for <code>std::move</code>) | ||
{{hidden | Example RAII Class | | {{hidden | Example RAII Class | | ||
Copied from [https://stackoverflow.com/questions/3279543/what-is-the-copy-and-swap-idiom stack overflow] | |||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
#include <algorithm> // std::copy | #include <algorithm> // std::copy |