lundi 16 octobre 2023

What is the efficient difference between insert and emplace? [duplicate]

What is the efficient difference between belows?

std::string a = "a";
std::string b = "b";

std::map<std::string, std::string> m;
m.insert({a,b});  -->1
m.insert(make_pair{a,b});  -->2
m.emplace(a,b);  -->3

Aucun commentaire:

Enregistrer un commentaire