[PATCH][Hashtable 0/6] Code review
François Dumont
frs.dumont@gmail.com
Thu Dec 19 19:17:00 GMT 2019
After further work on pretty printers I prefer to stay closer to what is
done currently. It works better with another patch I'll submit one day.
The drawback is that I needed to consider versioned namespace in
template parameters passed to lookup_templ_spec.
François
On 12/9/19 10:15 PM, François Dumont wrote:
> This patch also require an update of the printers.py file.
>
> Here is an updated version.
>
> François
>
> On 11/17/19 9:42 PM, François Dumont wrote:
>> This is the begining of a patch series for _Hashtable
>>
>> Initial patch to clarify code. I was tired to see true/false or
>> true_type/false_type without knowing what was true/false.
>>
>> I also made code more consistent by chosing to specialize methods
>> through usage of __unique_keys_t/__multi_keys_t rather than calling
>> them _M_[multi]_XXX.
>>
>>
>> Â Â Â * include/bits/hashtable_policy.h (__detail::__unique_keys_t): New.
>> Â Â Â (__detail::__multi_keys_t): New.
>> Â Â Â (__detail::__constant_iterators_t): New.
>> Â Â Â (__detail::__mutable_iterators_t): New.
>> Â Â Â (__detail::__hash_cached_t): New.
>> Â Â Â (__detail::__hash_not_cached_t): New.
>> Â Â Â (_Hash_node<>): Change _Cache_hash_code template parameter from
>> bool to
>> Â Â Â typename. Adapt partial specializations.
>> Â Â Â (_Node_iterator_base<>): Likewise.
>> Â Â Â (operator==(const _Node_iterator_base<>&,const
>> _Node_iterator_base<>&)):
>> Â Â Â Adapt.
>> Â Â Â (operator!=(const _Node_iterator_base<>&,const
>> _Node_iterator_base<>&)):
>> Â Â Â Adapt.
>> Â Â Â (_Node_iterator<>): Change __constant_iterators and __cache template
>> Â Â Â parameters from bool to typename.
>> Â Â Â (_Node_const_iterator<>): Likewise.
>> Â Â Â (_Map_base<>): Change _Unique_keys template parameter from bool to
>> Â Â Â typename. Adapt partial specializations.
>> Â Â Â (_Insert<>): Change _Constant_iterators template parameter from
>> bool to
>> Â Â Â typename. Adapt partial specializations.
>> Â Â Â (_Local_iterator_base<>): Change __cache_hash_code template
>> parameter
>> Â Â Â from bool to typename. Adapt partial specialization.
>> Â Â Â (_Hash_code_base<>): Likewise.
>> Â Â Â (operator==(const _Local_iterator_base<>&,
>> Â Â Â const _Local_iterator_base<>&)): Adapt.
>> Â Â Â (operator!=(const _Local_iterator_base<>&,
>> Â Â Â const _Local_iterator_base<>&)):
>> Â Â Â Adapt.
>> Â Â Â (_Local_iterator<>): Change __constant_iterators and __cache
>> template
>> Â Â Â parameters from bool to typename.
>> Â Â Â (_Local_const_iterator<>): Likewise.
>> Â Â Â (_Hashtable_base<>): Adapt.
>> Â Â Â (_Equal_hash_code<>): Adapt.
>> Â Â Â (_Equality<>): Adapt.
>> Â Â Â * include/bits/hashtable.h (_Hashtable<>): Replace occurences of
>> Â Â Â true_type/false_type by respoectively
>> __unique_type_t/__multi_type_t.
>> Â Â Â (_M_insert_unique_node(const key_type&, size_t, __hash_code,
>> Â Â Â __node_type*, size_t)): Replace by...
>> Â Â Â (_M_insert_node(__unique_keys_t, size_t, __hash_code, __node_type*,
>> Â Â Â size_t)): ...this.
>> Â Â Â (_M_insert_muti_node(__node_type*, const key_type&, __hash_code,
>> Â Â Â __node_type*)): Replace by...
>> Â Â Â (_M_insert_node(__multi_keys_t, __node_type*, __hash_code,
>> Â Â Â __node_type*)): ...this.
>> Â Â Â (_M_reinsert_node(node_type&&)): Replace by...
>> Â Â Â (_M_reinsert_node(node_type&&, __unique_keys_t)): ...this.
>> Â Â Â (_M_reinsert_node(const_iterator, node_type&&, __unique_keys_t)):
>> New,
>> Â Â Â forward to latter.
>> Â Â Â (_M_reinsert_node_multi(const_iterator, node_type&&)): Replace by...
>> Â Â Â (_M_reinsert_node(const_iterator, node_type&&, __multi_keys_t)):
>> Â Â Â ...this.
>> Â Â Â (_M_reinsert_node(node_type&&, __multi_keys_t)): New, forward to
>> latter.
>> Â Â Â (_M_reinsert_node(node_type&&)): New, use latters.
>> Â Â Â (_M_reinsert_node(const_iterator, node_type&&)): Likewise.
>> Â Â Â (_M_merge_unique(_Compatible_Hashtable&)): Replace by...
>> Â Â Â (_M_merge(__unique_keys_t, _Compatible_Hashtable&)): ...this.
>> Â Â Â (_M_merge_multi(_Compatible_Hashtable&)): Replace by...
>> Â Â Â (_M_merge(__multi_keys_t, _Compatible_Hashtable&)): ...this.
>> Â Â Â (_M_merge(_Compatible_Hashtable&)): New, use latters.
>> Â Â Â * include/bits/unordered_map.h
>> Â Â Â (unordered_map<>::insert(const_iterator, node_type&&)): Adapt.
>> Â Â Â (unordered_map<>::merge(unordered_map<>&)): Adapt.
>> (unordered_map<>::merge(unordered_multimap<>&)): Adapt.
>> Â Â Â (unordered_multimap<>::insert(node_type&&)): Adapt.
>> Â Â Â (unordered_multimap<>::insert(const_iterator, node_type&&)): Adapt.
>> (unordered_multimap<>::merge(unordered_multimap<>&)): Adapt.
>> (unordered_multimap<>::merge(unordered_map<>&)): Adapt.
>> Â Â Â * include/bits/unordered_set.h
>> Â Â Â (unordered_set<>::insert(const_iterator, node_type&&)): Adapt.
>> Â Â Â (unordered_set<>::merge(unordered_set<>&)): Adapt.
>> (unordered_set<>::merge(unordered_multiset<>&)): Adapt.
>> Â Â Â (unordered_multiset<>::insert(node_type&&)): Adapt.
>> Â Â Â (unordered_multiset<>::insert(const_iterator, node_type&&)): Adapt.
>> (unordered_multiset<>::merge(unordered_multiset<>&)): Adapt.
>> (unordered_multiset<>::merge(unordered_set<>&)): Adapt.
>>
>> Tested under Linux x86_64.
>>
>> François
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable#1.patch
Type: text/x-patch
Size: 56690 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20191219/d7d2a291/attachment.bin>
More information about the Libstdc++
mailing list