mardi 31 mars 2015

Should I use std::move on functions returning std::vector?

Consider this kind of a function:



std::vector<int> generateVector() {
return std::vector<int>(10, 0);
}


Are there any benefits in calling generateVector() like this:



std::vector<int> v = std::move(generateVector());


..or is this kind of a move optimization now automatically done by the compiler?


Aucun commentaire:

Enregistrer un commentaire