PR 54075 Fix hashtable::reserve
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Jul 25 14:55:00 GMT 2012
(CC gcc-patches)
On 25 July 2012 10:26, François Dumont wrote:
> Hi
>
> Here is a patch proposal for PR 54075. I also took the occasion to fix
> something that has been delay so far which is usage of std::max to get the
> number of buckets to use. The problem of using std::max when using the hash
> policy is that the hashtable might be using a number of buckets inconsistent
> with the hash policy.
>
> 2012-07-25 François Dumont <fdumont@gcc.gnu.org>
>
> PR libstdc++/54075
> * include/bits/hashtable.h
> (_Hashtable<>::_Hashtable(_InputIterator, _InputIterator,
> size_type, ...): Remove std::max usage to guaranty that hashtable
> state is consistent with hash policy state.
s/guaranty/guarantee/
> (_Hashtable<>::rehash): Likewise. Set _M_prev_resize to 0 to avoid
> the hashtable to be shrink on next insertion.
s/to be shrink/shrinking/
> * testsuite/23_containers/unordered_set/modifiers/reserve.cc: New.
> * testsuite/23_containers/unordered_multiset/modifiers/reserve.cc: New.
> * testsuite/23_containers/unordered_map/modifiers/reserve.cc: New.
> * testsuite/23_containers/unordered_multimap/modifiers/reserve.cc: New.
>
> Tested under Linux x86_64.
OK with the changelog edits above.
> I guess it will have to be apply to the 4.7 branch too, confirm please.
Yes, I think so, it's a regression from 4.6.
Thanks for dealing with it so quickly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable.patch
Type: text/x-patch
Size: 8633 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120725/3d76ee67/attachment.bin>
More information about the Gcc-patches
mailing list