CppCoreGuidelines
CppCoreGuidelines copied to clipboard
Improve reasoning and examples for F.48
With guaranteed copy elision, it is now almost always a pessimization to expressly use
std::movein a return statement.
The reasoning in F.48 is misleading because it only refers to guaranteed copy elision, but the example listed underneath shows NRVO, for which this elision is not guaranteed.
I think it the reasoning is much better if it is made clear to the reader that a return statement will always move local variables. It is also helpful to distinguish between RVO and NRVO in the example, as the two have optimization differences.