I have a code snippet which looks somewhat like this:
std::unordered_map<FooId, Foo> fooMap;
Foo foo1(..);
fooMap.emplace(foo1.id(), std::move(foo1));
Is the emplace safe, i.e. does the C++ language standard guarantee that foo1.id()
is invoked before std::move(foo1)
?
Aucun commentaire:
Enregistrer un commentaire