I'm having an hard time understanding this description of stl unordered map's implementation:
The standard template library (STL) for C++ provides hash tables via std::unordered_map and std::unordered_set. The standard guarantees reference stability: References and pointers to the keys and values in the hash table must remain valid until the corresponding key is removed. In practice, this means the entries must be indirect and individually allocated, which adds a substantial CPU overhead.
Two questions:
When the author says "references and pointers to the keys and values ... must remain valid" does that mean that after I insert an item, the pointer and reference must live for the entirety of the program? When I use "new" to allocate the object on the heap and the pointer to it goes out of scope and is no longer valid. I'm not sure why the reference/pointer needs to stay valid given that the hash table has reference to the object on the heap.
How do "indirect and individually allocated" entries "add substantial CPU overhead"?