C++23 Implicit Moves: Say Goodbye to std::move
Move in C++ without a std:move

Andreas Fertig explores how C++23's implicit move rules simplify code and improve performance. He revisits his earlier advice to use std::move rarely, showing that with C++23, functions returning rvalue reference parameters now move automatically, eliminating the need for manual std::move calls. This change builds on guaranteed copy elision since C++17 and makes following his advice easier than ever.
Once you switch your compiler to C++23 mode, both cases do an implicit move. No std::move required.
- sprocketz
What is that makes NVRO so much more difficult to implement? Why couldn't they mandate that just like RVO?
Do compilers literally just special case a simple return statement of a direct construction or something?
- fluoridation
Unfortunately, I don't think there's getting away from just understanding value semantics to get the correct and/or performant behavior.
- tom_
If the author is reading: both complicated examples are the same.