std::multimap<int,std::string> mymap;
mymap.emplace(1, "hello ");
mymap.emplace(1, "world!");
std::cout << mymap.size() << "\n";
Will this echo 1 or 2? I.e., can I use emplace to add new pairs to a multimap, without affecting older pairs with the same key?
Best to check on your own. From definition
std::multimap
allowes to have same key for different values,std::map
doesn't. Output is:2
, so it's allowed to have 2 different values under same key in multimap.IdeONE: https://ideone.com/eRkBmV