Expand calls to count and equal_range implementation

This commit is contained in:
Daniel James
2017-04-23 10:09:18 +01:00
parent 25b0b66e52
commit 13ff1e7fb1
3 changed files with 24 additions and 37 deletions

View File

@@ -1349,7 +1349,7 @@ template <class T, class H, class P, class A>
typename unordered_set<T, H, P, A>::size_type unordered_set<T, H, P, A>::count(
const key_type& k) const
{
return table_.count(k);
return table_.find_node(k) ? 1 : 0;
}
template <class T, class H, class P, class A>
@@ -1357,7 +1357,9 @@ std::pair<typename unordered_set<T, H, P, A>::const_iterator,
typename unordered_set<T, H, P, A>::const_iterator>
unordered_set<T, H, P, A>::equal_range(const key_type& k) const
{
return table_.equal_range(k);
node_pointer n = table_.find_node(k);
return std::make_pair(const_iterator(n),
const_iterator(n ? table::node_algo::next_node(n) : n));
}
template <class T, class H, class P, class A>
@@ -1747,7 +1749,8 @@ template <class T, class H, class P, class A>
typename unordered_multiset<T, H, P, A>::size_type
unordered_multiset<T, H, P, A>::count(const key_type& k) const
{
return table_.count(k);
node_pointer n = table_.find_node(k);
return n ? table::node_algo::count(n, &table_) : 0;
}
template <class T, class H, class P, class A>
@@ -1755,7 +1758,9 @@ std::pair<typename unordered_multiset<T, H, P, A>::const_iterator,
typename unordered_multiset<T, H, P, A>::const_iterator>
unordered_multiset<T, H, P, A>::equal_range(const key_type& k) const
{
return table_.equal_range(k);
node_pointer n = table_.find_node(k);
return std::make_pair(const_iterator(n),
const_iterator(n ? table::node_algo::next_group(n, &table_) : n));
}
template <class T, class H, class P, class A>