forked from boostorg/unordered
Replace several uses of iterators with node pointers.
Which is to some extent going in circles, as this is how the containers were originally implemented. But I think this is cleaner. It also fixes a minor problem where the internal and external iterator types are different for some containers, as the external iterators are all const.
This commit is contained in:
@@ -199,12 +199,12 @@ namespace unordered
|
||||
|
||||
iterator begin() BOOST_NOEXCEPT
|
||||
{
|
||||
return table_.begin();
|
||||
return iterator(table_.begin());
|
||||
}
|
||||
|
||||
const_iterator begin() const BOOST_NOEXCEPT
|
||||
{
|
||||
return table_.begin();
|
||||
return const_iterator(table_.begin());
|
||||
}
|
||||
|
||||
iterator end() BOOST_NOEXCEPT
|
||||
@@ -219,7 +219,7 @@ namespace unordered
|
||||
|
||||
const_iterator cbegin() const BOOST_NOEXCEPT
|
||||
{
|
||||
return table_.begin();
|
||||
return const_iterator(table_.begin());
|
||||
}
|
||||
|
||||
const_iterator cend() const BOOST_NOEXCEPT
|
||||
@@ -1161,7 +1161,7 @@ namespace unordered
|
||||
typename unordered_set<T,H,P,A>::const_iterator
|
||||
unordered_set<T,H,P,A>::find(const key_type& k) const
|
||||
{
|
||||
return table_.find_node(k);
|
||||
return const_iterator(table_.find_node(k));
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@@ -1173,7 +1173,7 @@ namespace unordered
|
||||
CompatibleHash const& hash,
|
||||
CompatiblePredicate const& eq) const
|
||||
{
|
||||
return table_.generic_find_node(k, hash, eq);
|
||||
return const_iterator(table_.generic_find_node(k, hash, eq));
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@@ -1445,7 +1445,7 @@ namespace unordered
|
||||
typename unordered_multiset<T,H,P,A>::const_iterator
|
||||
unordered_multiset<T,H,P,A>::find(const key_type& k) const
|
||||
{
|
||||
return table_.find_node(k);
|
||||
return const_iterator(table_.find_node(k));
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
@@ -1457,7 +1457,7 @@ namespace unordered
|
||||
CompatibleHash const& hash,
|
||||
CompatiblePredicate const& eq) const
|
||||
{
|
||||
return table_.generic_find_node(k, hash, eq);
|
||||
return const_iterator(table_.generic_find_node(k, hash, eq));
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
|
Reference in New Issue
Block a user