This question already has an answer here:
Assume I have the following
std::map<int, std::string> m;
std::string b = "bar";
If I emplace-move b into m like this:
auto result = m.emplace(0, std::move(b));
if (!result.first) {
// Here
}
Is b guaranteed to still contain "bar" at // Here? I have no doubt that any sane implementation of std::map::emplace will leave b alone when it is not being used to assign in the map, but is this guaranteed by the standard?
Aucun commentaire:
Enregistrer un commentaire