hashtable local iterator

François Dumont frs.dumont@gmail.com
Wed Dec 21 19:18:00 GMT 2011


On 12/21/2011 04:53 PM, Jonathan Wakely wrote:
> On 21 December 2011 01:27, Paolo Carlini wrote:
>> .. by the way, when working on this issue, make sure to have 'PR
>> libstdc++/51608' on the ChangeLog, and please also double check the latter
>> for typos (I see an 'unordere_map.H')
> And "whether hash code is cache or not" should be "cached" not "cache"
>
> There should be a new line after that, before "(_Hash_code_base):"
>
>
> Thanks for commenting the code thoroughly, the code is quite
> complicated, so good comments are very important.  I haven't studied
> the code closely enough to understand it all but there are several
> grammatical issues in the comments that made it harder for me.
>
I compiled you and Paolo feedback normally and here is the result.

I saw your feedback regarding usage of tuple, do you prefer a solution 
based on it ? Note that even if it works it will imply inclusion of 
tuple header each time unordered containers are used, is it ok ? I know 
Paolo is rather sensible on this subject :-)

2011-12-21  François Dumont <fdumont@gcc.gnu.org>

         PR libstdc++/51608
         * include/bits/hashtable_policy.h (_Equal_helper<>): New, 
change the
         way the _Equal functor is used depending on whether hash code is
         cached or not.
         (_Hash_code_base): Move _Equal functor management...
         (_Hashtable_base): ...here, new, use _Equal_helper.
         (_Local_iterator_base<>, _Locale_iterator<>, 
_Locale_const_iterator<>):
         New, use _Hash_code_base, implementation of...
         * include/bits/hashtable.h (_Hashtable<>::local_iterator,
         _Hashtable<>::const_local_iterator): ...those. Add static 
assertions
         checking that some functors are empty depending on whether hash 
code
         is cache or not.
         (_Hashtable<>::_M_bucket_index): New overloads using current bucket
         count, use through out the _Hastable<> implementation.
         * include/bits/unordered_set.h (__unordered_set<>,
         __unordered_multiset<>): Cache hash code if hash functor is not 
empty.
         * include/bits/unordere_map.h (__unordered_map<>,
         __unordered_multimap<>): Likewise.
         * include/debug/unordered_map
         (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local):
         Adapt to match new local iterator implementation.
         * include/debug/unordered_set (unordered_set<>::_S_to_local,
         unordered_multiset<>::_S_to_local): Likewise.
         * include/profile/unordered_map 
(unordered_map<>::_M_profile_destruct,
         unordered_multimap<>::_M_profile_destruct): Enhance thanks to 
usage of
         local iterators.
         * include/profile/unordered_set 
(unordered_set<>::_M_profile_destruct,
         unordered_multiset<>::_M_profile_destruct): Likewise.

François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable_local_iterator.patch
Type: text/x-patch
Size: 47270 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20111221/249804d2/attachment.bin>


More information about the Libstdc++ mailing list