martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.52k stars 146 forks source link

emplace invalidates existing iterators #67

Closed Oipo closed 4 years ago

Oipo commented 4 years ago

As can be seen on https://godbolt.org/z/AHH2G3 there's a bug that invalidates existing iterators.

Oipo commented 4 years ago

Same thing happens with insert, but not with erase.

jmousel commented 4 years ago

robin_hood doesn't offer the same iterator stability guarantees as std::unordered_map. Insert, emplace and erase invalidate all iterators as well references and pointers to keys or data.

Oipo commented 4 years ago

Oh, right, thanks.