3 ms·
In this case though the problem was trying to use a feature OP didn't understand. The straightforward naive code is also the best code, here. So it's not an ex
by knorker 6y ago
In this case though the problem was trying to use a feature OP didn't understand.
The straightforward naive code is also the best code, here. So it's not an example of what you describe. In fact at least on stl containers, and your own classes with such members, move semantics "just works". Rebuild the same c++98 code with c++11 and it just skips needless copies as part of the language, not implementation.
And it's not about second-guessing. The confusion here is not about the compiler implementation. It's about the language.