Hacker News new | ask | show | jobs
by jzwinck 686 days ago
There is another standard library related scenario: hash tables. The std unordered containers will store the hash of each key unless your hash function is noexcept. Analogous to how vector needs noexcept move for fast reserve and resize, unordered containers need noexcept hash to avoid extra memory usage. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/unordered_as...
1 comments

For many key types and access patterns, storing the hash is faster anyway. I assume people who care about performance are already not using std::unordered_map though.