Overview copy elision can be applied even if copying/moving the object has side-effects**. You shouldn’t have critical logic inside copy/move-constructors or destructors, as you can’t rely on them being called. Links c++ - What are copy elision and return value optimization? - Stack Overflow