[PATCH] PR libstdc++/87135 Rehash only when necessary (LWG2156)
François Dumont
frs.dumont@gmail.com
Thu Sep 13 05:49:00 GMT 2018
All changes limited to hashtable_c++0x.cc file.
_Prime_rehash_policy::_M_next_bkt now really does what its comment was
declaring that is to say:
 // Return a prime no smaller than n.
_Prime_rehash_policy::_M_need_rehash rehash only when _M_next_size is
exceeded, not only when it is reach.
   PR libstdc++/87135
   * src/c++11/hashtable_c++0x.cc:
   (_Prime_rehash_policy::_M_next_bkt): Return a prime no smaller than
   requested size, but not necessarily greater.
   (_Prime_rehash_policy::_M_need_rehash): Rehash only if target size is
   strictly greater than next resize threshold.
   * testsuite/23_containers/unordered_map/modifiers/reserve.cc: Adapt
test
   to validate that there is no rehash as long as number of insertion is
   lower or equal to the reserved number of elements.
unordered_map tests successful, ok to commit once all other tests
completed ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 87135.patch
Type: text/x-patch
Size: 3287 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180913/597e5708/attachment.bin>
More information about the Libstdc++
mailing list