I've seen many statements that when you want to copy a value inside a function it is better to pass it by value and do an std::move
inside that function (since C++11). See here and here for example.
If that is correct, then why does the std containers in C++11 such as std::vector
still have pass-by-ref overloads for methods such as push_back
?
Wouldn't it be better to just change them to pass-by-value methods and call std::move
inside them?