https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95079

--- Comment #6 from François Dumont <fdumont at gcc dot gnu.org> ---
Thanks for the feedback.

If this is still a problem for you after this enhancement you should perhaps
try the _Power2_rehash_policy provided as an extension. In
testsuite/23_containers/unordered_set/insert/hash_policy.cc you'll see an
example with a unordered_set like container defined as:

template<typename _Value, typename _Hash,
         typename _Pred, typename _Alloc>
  using unordered_set_power2_rehash =
  std::_Hashtable<_Value, _Value, _Alloc,
                  std::__detail::_Identity,
                  _Pred,
                  _Hash,
                  std::__detail::_Mask_range_hashing,
                  std::__detail::_Default_ranged_hash,
                  std::__detail::_Power2_rehash_policy,
                  std::__detail::_Hashtable_traits<false, true, true>>;

As stated by its name _Power2_rehash_policy will make sure that number buckets
is a power of 2 and so make the modulo much trivial.

Reply via email to