top | item 41165344

(no title)

jzwinck | 1 year 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...

discuss

order

anonymoushn|1 year ago

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.