C++ implementation of a fast hash map and hash set using robin hood hashing
erase_fast(iterator pos)
method which in contrast to erase(iterator pos)
doesn't return an iterator, avoiding the cost of looking for the next element after erasure of the element at iterator pos
.This release fixes a rare but critical bug which only occurs when a very long collision chain (> 32 767) occurs due to a poor hash function, see first bullet point. Upgrade is recommended.
dist_from_ideal_bucket
is > DIST_FROM_IDEAL_BUCKET_LIMIT
during insertion (fix issue #52)
dist_from_ideal_bucket
to be sure it doesn't becomes bigger than DIST_FROM_IDEAL_BUCKET_LIMIT
but this was only done during the robin swap. A check should also be done beforehand if we find an empty bucket otherwise the variable could overflow and lead to bugs. This commit adds this check.std::aligned_storage
since C++23 by alignas
(#61)DIST_FROM_IDEAL_BUCKET_LIMIT
to 8192std::launder
the reinterpreted pointer from std::aligned_storage
to adapt to the change of object model introduced in P0137R1. Fix potential but very unlikely undefined behaviour.
std::aligned_storage
to be laundered. See the following discussion for some details https://stackoverflow.com/questions/47735657/does-reinterpret-casting-stdaligned-storage-to-t-without-stdlaunder-violat
defined(TSL_DEBUG)
instead of !defined(NDEBUG)
Minor release to fix tests compilation on some platforms, no change in the library code itself.
prime_growth_policy
on a 64-bit platform.min_load_factor()
> 0, the clear()
method will also reset the bucket_count
of the hash table to 0.min_load_factor
is set and a range erase with end()
as last
is called. The m_try_skrink_on_next_insert
was not correctly set.const iterator
can now be called and returns a mutable reference to the underlying value_type
.distance_type
used to store the distance of a value in a bucket from its ideal bucket could overflow when a lot of collisions happened and the load_factor()
stayed below REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR
. We now rehash no matter the load factor if the distance becomes too high.bool contains(...)
methods.insert
with hint method to insert_hint
to avoid a potential ambiguous overload with the insert
with a pair of iterators.tsl_robin_map
to tsl-robin-map
for coherence with the convention used by most package managers. The find_package(tsl-robin-map)
command must now be used instead of the find_package(tsl_robin_map)
.tsl-robin-map.natvis
to the installed files.cxx_std_11
from target_compile_features
to avoid a warning with older versions of CMake that don't support it. The warning was given even if the target_compile_features
was surrounded in a if(${CMAKE_VERSION} VERSION_GREATER "3.7")
.max_bucket_count
is reached. It's the maximum bucket count that has been reached and not the size.