[v3] fix libstdc++/52446

François Dumont frs.dumont@gmail.com
Tue Mar 13 21:50:00 GMT 2012


Hi

     Here a patch proposition to fix PR 52446.

     I have introduce 2 version of the _M_rehash method. One used when 
keys are unique which is very close to the existing one. The second that 
take care of keeping equivalent keys relative order on rehash. The 
second one might seem complicated but I wanted to avoid to recompute a 
bucket index each time we find an equivalent element. If the hash code 
is cached it is ok but if it is not I prefer to limit the number of time 
it is recalculated.

2012-03-13  François Dumont <fdumont@gcc.gnu.org>

     PR libstdc++/52446
     * include/bits/hashtable.h (_Hashtable<>::_M_rehash): Split into 2
     methods, the first, copy of the existing one, is used when keys
     are unique, the second purpose is to keep equivalent keys relative
     orders.
     * testsuite/23_containers/unordered_multimap/insert/52446.cc: New.

Tested under linux x86_64.

If ok tell me if I must also apply it to 4.7 branch.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 52446.patch
Type: text/x-patch
Size: 8310 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20120313/980655bc/attachment.bin>


More information about the Libstdc++ mailing list