Answer the question
In order to leave comments, you need to log in
Will std::move be removed?
Hello.
I think I've read that somewhere around C++20 the compiler will be smart enough to do std::move on its own, and the programmer won't even need to do that optimization anymore.
But.
I can't find it.
If you've heard it too, post the link!
(Well, or I'll have to assume that I messed something up;))
Answer the question
In order to leave comments, you need to log in
In C++20, this will definitely not happen. Moreover, I did not see this in the plans. The problem is that move (semantics, not the command itself) is not an optimization, but a fundamentally different operation. Optimization is different in that it doesn't change behavior (actually not always, but in most cases). We may be interested in the fact that the place from which we made move will become empty. But with a normal assignment, this is not the case.
In those places where it can be done automatically, it already works. RVO, NRVO optimizations for return values. And temporary objects, by definition, do not require the explicit use of move.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question