map
keeps iterators to all elements stable, in C++17 you can even move elements from one map
to the other without invalidating iterators to them (and if properly implemented without any potential allocation).map
timings for single operations are typically more consistent since they never need large allocations.unordered_map
using std::hash
as implemented in the libstdc++ is vulnerable to DoS if fed with untrusted input (it uses MurmurHash2 with a constant seed - not that seeding would really help, see https://emboss.github.io/blog/2012/12/14/breaking-murmur-hash-flooding-dos-reloaded/).