c++ - Does unordered_map iterator/reference invalidation allow for cuckoo, hopscotch, and robin hood hashing? -


i'm trying figure out if it's possible build conformant, efficient implementation of modern c++'s std::unordered_map using techniques cuckoo hashing, hopscotch hashing, , robin hood hashing allow compact tables, high load factors, , maintain high performance. what's special these techniques involve potentially moving elements around make room others, rather chaining, or probing until open slot found (as in linear or quadratic probing) or.

from insert http://www.cplusplus.com/reference/unordered_map/unordered_map/insert/

  1. iterator validity on cases, iterators in container remain valid after insertion. exception being when growth of container forces rehash. in case, iterators in container invalidated.

  2. a rehash forced if new container size after insertion operation increase above capacity threshold (calculated container's bucket_count multiplied max_load_factor).

  3. references elements in unordered_map container remain valid in cases, after rehash.

and erase http://www.cplusplus.com/reference/unordered_map/unordered_map/erase/

  1. only iterators , references elements removed invalidated.

  2. the rest unaffected.

  3. [c++14 only] relative order of iteration of elements not removed operation preserved.

the requirement other references remain valid in both operations seem require probing scheme involving evictions work on table structure allocated nodes separate array , pointed @ them instead. perhaps implementation keep separate array of elements entries in table index into, avoid dynamic allocation, still adds indirection. there more efficient way address requirement?

the requirement element references remain valid across insert after rehash seems imply either dynamic node allocation or above indirection array required chaining or non-moving open addressing design. right?

in general, requirement placed on unordered_map standard enforce indirection or other sort of inefficiency in hash table implementation?


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -