summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/debug/unordered_set
diff options
context:
space:
mode:
authorfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-29 17:58:51 +0000
committerfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-29 17:58:51 +0000
commitb22f309439a7cb1bffb7704c8c2948ff5c03fb53 (patch)
tree903f20038569d2020a81aba0417a85a922d4b121 /libstdc++-v3/include/debug/unordered_set
parentc3a99842fcfea482550df77d5dff4c78f57ca3d1 (diff)
downloadppe42-gcc-b22f309439a7cb1bffb7704c8c2948ff5c03fb53.tar.gz
ppe42-gcc-b22f309439a7cb1bffb7704c8c2948ff5c03fb53.zip
2011-12-29 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. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. 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 iff hash functor is not empty and not final. * include/bits/unordered_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. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug/unordered_set')
-rw-r--r--libstdc++-v3/include/debug/unordered_set24
1 files changed, 20 insertions, 4 deletions
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index ba4404028e3..7323184d438 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -417,11 +417,19 @@ namespace __debug
static _Base_local_iterator
_S_to_local(_Base_iterator __it)
- { return _Base_local_iterator(__it._M_cur); }
+ {
+ // The returned local iterator will not be incremented so we don't
+ // need to compute __it's node bucket
+ return _Base_local_iterator(__it._M_cur, 0, 0);
+ }
static _Base_const_local_iterator
_S_to_local(_Base_const_iterator __it)
- { return _Base_const_local_iterator(__it._M_cur); }
+ {
+ // The returned local iterator will not be incremented so we don't
+ // need to compute __it's node bucket
+ return _Base_const_local_iterator(__it._M_cur, 0, 0);
+ }
};
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
@@ -805,11 +813,19 @@ namespace __debug
static _Base_local_iterator
_S_to_local(_Base_iterator __it)
- { return _Base_local_iterator(__it._M_cur); }
+ {
+ // The returned local iterator will not be incremented so we don't
+ // need to compute __it's node bucket
+ return _Base_local_iterator(__it._M_cur, 0, 0);
+ }
static _Base_const_local_iterator
_S_to_local(_Base_const_iterator __it)
- { return _Base_const_local_iterator(__it._M_cur); }
+ {
+ // The returned local iterator will not be incremented so we don't
+ // need to compute __it's node bucket
+ return _Base_const_local_iterator(__it._M_cur, 0, 0);
+ }
};
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
OpenPOWER on IntegriCloud