mercredi 27 avril 2016

std::move with std::make_pair

Is there any difference between:

std::map <int,std::pair<T,T>> m;
T t1,t2;
m.emplace(1,std::make_pair(t1,t2));

and:

std::map <int,std::pair<T,T>> m;
T t1,t2;
m.emplace(1,std::move(std::make_pair(t1,t2)));

Is the std::move redunddent here? Will std::map::emplace and perfect forwarding take care of allocating the std::pair directly in the std::map?

Aucun commentaire:

Enregistrer un commentaire