i don't undertstand fully this answer. Why we not all using type with std::move?
Example;
std::map<int, int> try;
void foo(std::map<int, int>& try, int t1, int t2)
{
try.emplace(std::move(t1), std::move(t2));
}
int main()
{
int k = 1;
int v = 5;
try.emplace(k , v); // emplace copies
foo(try, k, v); // emplace referance
return 0;
}
so what is the different emplace copies and emplace referance? I know std::move more efficient than use copies. (if i know wrong, sorry. I'm beginner) So what can i use? Using copies or std::move? Sorry for my bad english.
Aucun commentaire:
Enregistrer un commentaire