Skip to content

Commit

Permalink
Don't use default-constructed KeyNodeCompare to support stateful comp…
Browse files Browse the repository at this point in the history
…arison objects
  • Loading branch information
igaztanaga committed Jun 5, 2024
1 parent 24c978b commit 13be16a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/boost/container/detail/tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1240,13 +1240,13 @@ class tree
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, iterator>::type
find(const K& k)
{ return iterator(this->icont().find(k, KeyNodeCompare())); }
{ return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); }

template <class K>
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type
find(const K& k) const
{ return const_iterator(this->non_const_icont().find(k, KeyNodeCompare())); }
{ return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); }

BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
size_type count(const key_type& k) const
Expand All @@ -1256,7 +1256,7 @@ class tree
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, size_type>::type
count(const K& k) const
{ return size_type(this->icont().count(k, KeyNodeCompare())); }
{ return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); }

BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
bool contains(const key_type& x) const
Expand All @@ -1280,13 +1280,13 @@ class tree
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, iterator>::type
lower_bound(const K& k)
{ return iterator(this->icont().lower_bound(k, KeyNodeCompare())); }
{ return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); }

template <class K>
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type
lower_bound(const K& k) const
{ return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare())); }
{ return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); }

BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
iterator upper_bound(const key_type& k)
Expand All @@ -1300,13 +1300,13 @@ class tree
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, iterator>::type
upper_bound(const K& k)
{ return iterator(this->icont().upper_bound(k, KeyNodeCompare())); }
{ return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); }

template <class K>
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type
upper_bound(const K& k) const
{ return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare())); }
{ return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); }

BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
std::pair<iterator,iterator> equal_range(const key_type& k)
Expand All @@ -1330,7 +1330,7 @@ class tree
equal_range(const K& k)
{
std::pair<iiterator, iiterator> ret =
this->icont().equal_range(k, KeyNodeCompare());
this->icont().equal_range(k, KeyNodeCompare(key_comp()));
return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second));
}

Expand All @@ -1340,7 +1340,7 @@ class tree
equal_range(const K& k) const
{
std::pair<iiterator, iiterator> ret =
this->non_const_icont().equal_range(k, KeyNodeCompare());
this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp()));
return std::pair<const_iterator,const_iterator>
(const_iterator(ret.first), const_iterator(ret.second));
}
Expand Down Expand Up @@ -1368,7 +1368,7 @@ class tree
lower_bound_range(const K& k)
{
std::pair<iiterator, iiterator> ret =
this->icont().lower_bound_range(k, KeyNodeCompare());
this->icont().lower_bound_range(k, KeyNodeCompare(key_comp()));
return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second));
}

Expand All @@ -1378,7 +1378,7 @@ class tree
lower_bound_range(const K& k) const
{
std::pair<iiterator, iiterator> ret =
this->non_const_icont().lower_bound_range(k, KeyNodeCompare());
this->non_const_icont().lower_bound_range(k, KeyNodeCompare(key_comp()));
return std::pair<const_iterator,const_iterator>
(const_iterator(ret.first), const_iterator(ret.second));
}
Expand Down

0 comments on commit 13be16a

Please sign in to comment.