max_load_factor constant complexity

François Dumont
Tue Jun 30 20:25:00 GMT 2015


    During a recent discussion on Reflector about max_load_factor some
pointed that libstdc++ has not the constant complexity as imposed by the
Standard in Table 103 because we try to respect the new factor by
potentially rehashing the container. This patch fix this problem by
adopting VS Standard Library behavior of retaining the targeted
max_load_factor and comply to it as soon as possible on insertion.

    * include/bits/hashtable.h (_Hashtable<>::__rehash_policy): Remove
    container rehash.
    * testsuite/23_containers/unordered_set/max_load_factor/

Tested under linux x86_64.

Ok to commit ?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: constant_max_load_factor.patch
Type: text/x-patch
Size: 3490 bytes
Desc: not available
URL: <>

More information about the Libstdc++ mailing list