vendredi 26 juin 2015

C++11 tuple with copy elision or move semantic

I wrote a function like below:

template <typename T>
std::tuple<std::vector<T>, T, T> f() {
    std::vector<T> p(1000);
    return std::make_tuple(std::move(p), 10, 10);
}

Is it guaranteed that the compiler will either apply copy elision or move semantic when it constructs the result?

Aucun commentaire:

Enregistrer un commentaire