hash policy patch

Paolo Carlini paolo.carlini@oracle.com
Fri Sep 16 01:01:00 GMT 2011


Hi,
> And here is this one again:
>
> 2011-09-14  François Dumont <fdumont@gcc.gnu.org>
>
>         * include/bits/hashtable.h (_Hashtable<>::__rehash_policy(const
>         _RehashPolicy&)): Commit the modification of the policy only 
> if no
>         exception occured.
>         * 
> testsuite/23_containers/unordered_set/max_load_factor/robustness.cc:
>         New.

Ok... but:

+	  us.max_load_factor(.5f);
+	  VERIFY( us.max_load_factor() == .5f );

as we discussed already (didn't we?), this kind of VERIFY is in general 
very brittle (even if on the widespread base-2 systems probably we are 
lucky in this *specific* case): please just remove it, I don't think 
we'll miss much anyway.
> I also wondered if in __rehash_policy method we shouldn't rehash as 
> soon as __n_bkt != _M_bucket_count rather than only when __n_bkt > 
> _M_bucket_count. Users might change max load factor also to reduce the 
> number of buckets...
I should find the time to check C++11 about this. I'll let you know my 
opinion ASAP.

Paolo.



More information about the Libstdc++ mailing list