max_load_factor constant complexity

François Dumont frs.dumont@gmail.com
Tue Jun 30 20:25:00 GMT 2015


Hi

    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/robustness.cc:
    Adapt.

Tested under linux x86_64.

Ok to commit ?

François



-------------- 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: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150630/a6c198b5/attachment.bin>


More information about the Libstdc++ mailing list