4 ms·
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 noexc
by jzwinck 2y 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_associative.html https://gcc.gnu.org/onlinedocs/libstdc++/manual/unordered_as...
- anonymoushn 2y agoFor 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.