Re:But I was helping the compiler
by aw1621107 on Friday August 21, 2020 @01:27PM
(#24236964)
I think the calls to std::move in those specific examples are due to optimization flags not being passed to the compiler invocations on godbolt.
That being said, I've definitely heard of std::move in the wrong places preventing optimizations (e.g., std::move on a return statement can (will?) inhibit copy elison), but I'm not familiar enough with the finer details of C++ be able to tell you why.
That being said, I've definitely heard of std::move in the wrong places preventing optimizations (e.g., std::move on a return statement can (will?) inhibit copy elison), but I'm not familiar enough with the finer details of C++ be able to tell you why.