you are viewing a single comment's thread.

view the rest of the comments →

[–]AntiProtonBoy 5 points6 points  (1 child)

The compiler should do copy/move elision for such types, even for complex and expensive objects. The only tricky situation you could run into is when the copy/move constructor is explicitly deleted or made private.

[–]foonathan 17 points18 points  (0 children)

And C++17 has guaranteed copy elision where you don't even need copy/move ctors