This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: hash policy patch


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]