Reputation: 8317
I was wandering the C++ specifications (cplusplus.com) and found that there's nothing told about exception safety for std::unordered_map
so basically if I write
map["foo"]=5;
and an exception is thrown because I'm out of memory or bad_alloc, what can I assume about my map?
Upvotes: 3
Views: 1070
Reputation: 218700
23.2.4.1 Exception safety guarantees [associative.reqmts.except]
2 For associative containers, if an exception is thrown by any operation from within an insert or emplace function inserting a single element, the insertion has no eftect.
This paragraph applies to the indexing operator. So:
Upvotes: 5