[PATCH][Hashtable 5/6] Remove H1/H2 template parameters

François Dumont frs.dumont@gmail.com
Sun Nov 17 21:15:00 GMT 2019


H1 used to be a reference to the user Hash, now _Hashtable and unordered 
types agree on the same Hash type which is more intuitive.

I also chose to not support anymore a stateful ranged hash functor. We 
only use _Mod_range_hashing and _Mask_range_hashing.

Thanks to this simplification _M_bucket_index can also be simplified.

     * include/bits/hashtable_policy.h (_Hashtable<>): Remove _H1 and _H2
     template parameters.
     (_Hastable_base<>): Likewise.
     (_Default_ranged_hash): Remove.
     (_Prime_rehash_policy::__ranged_hash): New.
     (_Power2_rehash_policy::__ranged_hash): New.
     (_Map_base<>): Remove _H1 and _H2 template parameters.
     (_Insert_base<>): Likewise.
     (_Insert<>): Likewise.
     (_Rehash_base<>): Likewise.
     (_Local_iterator_base<>): Remove _H1 and _H2 template parameters 
and add
     _RangedHash.
     (_Hash_code_base<>): Likewise.
     (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash,
     __hash_not_cached_t>): Remove.
     (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)):
     Replace by...
     (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this.
     (_Local_iterator<>): Remove _H1 and _H2 template parameters.
     (_Local_const_iterator<>): Likewise.
     (_Equality<>): Likewise.
     * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template
     parameters.
     * include/bits/node_handle.h: Adapt.
     * include/bits/unordered_map.h: Adapt.
     * include/bits/unordered_set.h: Adapt.
     * testsuite/23_containers/unordered_set/hash_policy/26132.cc: Adapt.
     * testsuite/23_containers/unordered_set/hash_policy/71181.cc: Adapt.
     * testsuite/23_containers/unordered_set/hash_policy/load_factor.cc:
     Adapt.
     * testsuite/23_containers/unordered_set/hash_policy/rehash.cc: Adapt.
     * testsuite/23_containers/unordered_set/insert/hash_policy.cc: Adapt.
     * testsuite/23_containers/unordered_set/max_load_factor/robustness.cc:
     Adapt.
     * testsuite/performance/23_containers/insert/54075.cc: Adapt.
     * testsuite/performance/23_containers/insert_erase/41975.cc: Adapt.
     * testsuite/performance/23_containers/insert_erase/
     unordered_small_size.cc: Adapt.

Tested under Linux x86_64.

François


-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable#6.patch
Type: text/x-patch
Size: 88317 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20191117/1f6a95dd/attachment.bin>


More information about the Libstdc++ mailing list