The following is an anti-pattern:
auto f() {
std::vector<int> v(100000);
return std::move(v); // no need to use std::move thanks to RVO (return value optimization)
}
Using a std::move can even produce worst code (see here)
However, what should I do in the following situation:
auto f() {
std::vector<int> v0(100000);
std::vector<int> v1(100000);
return std::make_pair(std::move(v0),std::move(v1)); // is the move needed?
}