v1.2.0
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.
- Keep rehashing if
dist_from_ideal_bucket
is >DIST_FROM_IDEAL_BUCKET_LIMIT
during insertion (fix issue #52)- During insertion a check was done on
dist_from_ideal_bucket
to be sure it doesn't becomes bigger thanDIST_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. - The bug should only manifest itself if the collision chain becomes larger than 32 767 due to a very poor hash function.
- During insertion a check was done on
- Disable CMake install rule if robin_map is used as subproject (#60)
- Replace deprecated
std::aligned_storage
since C++23 byalignas
(#61) - Raise
DIST_FROM_IDEAL_BUCKET_LIMIT
to 8192 - Clear and shrink the moved hash table in the move operator to be coherent with the move constructor
- When using C++17,
std::launder
the reinterpreted pointer fromstd::aligned_storage
to adapt to the change of object model introduced in P0137R1. Fix potential but very unlikely undefined behaviour.- C++17 introduced a change in the object model with P0137R1 which now requires the reinterpreted pointer from
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
- C++17 introduced a change in the object model with P0137R1 which now requires the reinterpreted pointer from
- When exceptions are disabled, only print the error message when
defined(TSL_DEBUG)
instead of!defined(NDEBUG)
- Check that bucket_count doesn't exceed max_bucket_count() after the constructor initialization
- max_bucket_count() method relies on m_buckets_data which needs to be properly initialized first