re PR libstdc++/71181 (Reserving in unordered_map doesn't reserve enough)
authorFrançois Dumont <fdumont@gcc.gnu.org>
Mon, 20 Jun 2016 20:04:25 +0000 (20:04 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Mon, 20 Jun 2016 20:04:25 +0000 (20:04 +0000)
commit29dbb034cb3199167a9d0aaed040733c72326eed
treec86343a665d22d10f0591ce6f4b23b371cb0f8fd
parent3947cf1919a959ad8e2a3f09b42c604c5553a6c4
re PR libstdc++/71181 (Reserving in unordered_map doesn't reserve enough)

2016-06-20  François Dumont  <fdumont@gcc.gnu.org>

PR libstdc++/71181
* include/tr1/hashtable_policy.h
(_Prime_rehash_policy::_M_next_bkt): Make past-the-end iterator
dereferenceable to avoid check on lower_bound result.
(_Prime_rehash_policy::_M_bkt_for_elements): Call latter.
(_Prime_rehash_policy::_M_need_rehash): Likewise.
* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
Always return a value greater than input value. Set _M_next_resize to
max value when reaching highest prime number.
* src/shared/hashtable-aux.cc (__prime_list): Add comment about sentinel
being now useless.
* testsuite/23_containers/unordered_set/hash_policy/71181.cc: New.
* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc
(test02): New.
* testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc: New.
* testsuite/23_containers/unordered_set/hash_policy/rehash.cc:
Fix indentation.

From-SVN: r237617
libstdc++-v3/ChangeLog
libstdc++-v3/include/tr1/hashtable_policy.h
libstdc++-v3/src/c++11/hashtable_c++0x.cc
libstdc++-v3/src/shared/hashtable-aux.cc
libstdc++-v3/testsuite/23_containers/unordered_set/hash_policy/71181.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc
libstdc++-v3/testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_set/hash_policy/rehash.cc