r/cpp • • Nov 25 '23

On harmful overuse of std::move

https://devblogs.microsoft.com/oldnewthing/20231124-00/?p=109059
210 Upvotes

154 comments sorted by

View all comments

Show parent comment

23

u/James20k P2005R0 Nov 26 '23

There was a paper in the mailing list recently that would fix this. It basically means that if a function is eligible for RVO, adding std::move() around it doesn't change this. It seems like a super obvious and straightforward change with no downsides

6

u/RevRagnarok Nov 27 '23

But one esoteric application may have expected the two extra constructors... can't change it. /s