Open boukhelef opened 5 years ago
When using it against std::map, everything is fine!
While this container has an interface similar to C++ standard associative container, this container is not a part of the C++ standard library, hence those requirements do not apply.
It is unfortunate for the C++ standard that those requirements do not allow for fast associative containers with open addressing.
@boukhelef flat (hash) maps may invalidate iterators: that's the point of flat part: once you need to resize, you'll have to move your data.
According to the C++ standard, all Associative Containers: The insert and emplace members shall not affect the validity of iterators and references to the container [26.2.6/9]. However I found that after insertion of of a list of element, some iterator values are invalidated.
Please find bellow code snippet to test this feature:
namespace xxx { typedef std::string key_t; typedef std::string value_t;
} ... std::vector keys(MAX_SIZE__);
generatKeys(keys);
...
for (auto& key : keys) {
std::pair < xxx::map_t::iterator, bool> ret = dict.insert(xxx::map_t::value_type(key, keys[rand() % MAX_SIZE__]));