Rule of 5: It Is Not Just About the Destructor
For resource managing in classes, do not think that move will always move. It will fallback to copy if the object is not moveable. Or if the operation throws an exception, it will fall back to copy as well, so always mark the move constructor as noexcept as we saw on the previous blog about move semantics. struct MyClass{ std::vector<int> m_data; ~MyClass() = default; }; Given the above class, consider the below lines: ...