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

@ -3771,11 +3771,6 @@ struct table_unique : boost::unordered::detail::table<Types>
// Accessors
std::size_t count(const_key_type& k) const
{
return this->find_node(k) ? 1 : 0;
}
value_type& at(const_key_type& k) const
{
if (this->size_) {
@ -3788,13 +3783,6 @@ struct table_unique : boost::unordered::detail::table<Types>
std::out_of_range("Unable to find key in unordered_map."));
}
std::pair<iterator, iterator> equal_range(const_key_type& k) const
{
node_pointer n = this->find_node(k);
return std::make_pair(
iterator(n), iterator(n ? node_algo::next_node(n) : n));
}
// equals
bool equals(table_unique const& other) const
@ -4493,21 +4481,6 @@ struct table_equiv : boost::unordered::detail::table<Types>
this->move_init(x);
}
// Accessors
std::size_t count(const_key_type& k) const
{
node_pointer n = this->find_node(k);
return n ? node_algo::count(n, this) : 0;
}
std::pair<iterator, iterator> equal_range(const_key_type& k) const
{
node_pointer n = this->find_node(k);
return std::make_pair(
iterator(n), iterator(n ? node_algo::next_group(n, this) : n));
}
// Equality
bool equals(table_equiv const& other) const

View File

@ -1682,7 +1682,7 @@ template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::size_type
unordered_map<K, T, H, P, A>::count(const key_type& k) const
{
return table_.count(k);
return table_.find_node(k) ? 1 : 0;
}
template <class K, class T, class H, class P, class A>
@ -1690,7 +1690,9 @@ std::pair<typename unordered_map<K, T, H, P, A>::iterator,
typename unordered_map<K, T, H, P, A>::iterator>
unordered_map<K, T, H, P, A>::equal_range(const key_type& k)
{
return table_.equal_range(k);
node_pointer n = table_.find_node(k);
return std::make_pair(
iterator(n), iterator(n ? table::node_algo::next_node(n) : n));
}
template <class K, class T, class H, class P, class A>
@ -1698,7 +1700,9 @@ std::pair<typename unordered_map<K, T, H, P, A>::const_iterator,
typename unordered_map<K, T, H, P, A>::const_iterator>
unordered_map<K, 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 K, class T, class H, class P, class A>
@ -2146,7 +2150,8 @@ template <class K, class T, class H, class P, class A>
typename unordered_multimap<K, T, H, P, A>::size_type
unordered_multimap<K, 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 K, class T, class H, class P, class A>
@ -2154,7 +2159,9 @@ std::pair<typename unordered_multimap<K, T, H, P, A>::iterator,
typename unordered_multimap<K, T, H, P, A>::iterator>
unordered_multimap<K, T, H, P, A>::equal_range(const key_type& k)
{
return table_.equal_range(k);
node_pointer n = table_.find_node(k);
return std::make_pair(iterator(n),
iterator(n ? table::node_algo::next_group(n, &table_) : n));
}
template <class K, class T, class H, class P, class A>
@ -2162,7 +2169,9 @@ std::pair<typename unordered_multimap<K, T, H, P, A>::const_iterator,
typename unordered_multimap<K, T, H, P, A>::const_iterator>
unordered_multimap<K, 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 K, class T, class H, class P, class A>

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>