STL Hash Table Questions

I have a quick question about hash tables (unordered associative containers) in the STL.

Why are hash table specific APIs provided? like the load_factor() function, bucket() and bucket_count()? I know these are used to know about what bucket each entry is listed in, but why would you even need to know the underlying implementation details of hash tables and what could these details be used for? Can't you just use the hash table abstraction?
Last edited on
Hash tables can have collisions, which leads to rehashing. These functions are helpful in debugging/studying intensive use of hash tables.
Last edited on
Is collision handling the only purpose of these methods?
Well the STL does not really allow "handling" of collisions, but you could try to restructure insertions to try to avoid collisions. That would be beyond my knowledge though. I just know that having the hash map rehashed often is not necessarily a good thing.
Topic archived. No new replies allowed.