NewC++

Move in C++ without a std::move -- Andreas Fertig

C++ trainer Andreas Fertig follows up his advice to use std::move only rarely with an article on getting moves and best performance by default without it. He argues unnecessary copy operations are a major performance enemy and that return value optimization (RVO) should be the goal, since the returned object is created at the call site, avoiding both copy and move. Returning a braced temporary gets guaranteed copy elision since C++17, while named return value optimization (NRVO) is not guaranteed but usually avoids the cost too.

AI-written summary, checked against the cited sources. How summaries work

Image: isocpp.org

Read at isocpp.org