Remove std::move() calls that prevent NRVO (#1217)
Summary: > Under the following circumstances, the compilers are permitted to omit the copy and move construction of class objects: > In a return statement, when the operand is the name of a non-volatile object with automatic storage duration, which isn't a function parameter or a catch clause parameter, and which is of the same class type (ignoring cv-qualification) as the function return type. This variant of copy elision is known as NRVO, "named return value optimization". `std::move()` prevents this optimization. GCC 9.1.0 warning: ``` moving a local object in a return statement prevents copy elision [-Wpessimizing-move] ``` Pull Request resolved: https://github.com/facebook/folly/pull/1217 Reviewed By: LeeHowes Differential Revision: D17173234 Pulled By: yfeldblum fbshipit-source-id: ed63ef89dfd01883ddd6fd775285997f96a029fd
Showing
Please register or sign in to comment