From 13be16a0c8e60468f0c2a99a4c474e175aa4ee29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 5 Jun 2024 11:20:11 +0200 Subject: [PATCH] Don't use default-constructed KeyNodeCompare to support stateful comparison objects --- include/boost/container/detail/tree.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp index 7add430..5c0c383 100644 --- a/include/boost/container/detail/tree.hpp +++ b/include/boost/container/detail/tree.hpp @@ -1240,13 +1240,13 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::type find(const K& k) - { return iterator(this->icont().find(k, KeyNodeCompare())); } + { return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); } template BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::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 @@ -1256,7 +1256,7 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::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 @@ -1280,13 +1280,13 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::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 BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::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) @@ -1300,13 +1300,13 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::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 BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent::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 equal_range(const key_type& k) @@ -1330,7 +1330,7 @@ class tree equal_range(const K& k) { std::pair ret = - this->icont().equal_range(k, KeyNodeCompare()); + this->icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair(iterator(ret.first), iterator(ret.second)); } @@ -1340,7 +1340,7 @@ class tree equal_range(const K& k) const { std::pair ret = - this->non_const_icont().equal_range(k, KeyNodeCompare()); + this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair (const_iterator(ret.first), const_iterator(ret.second)); } @@ -1368,7 +1368,7 @@ class tree lower_bound_range(const K& k) { std::pair ret = - this->icont().lower_bound_range(k, KeyNodeCompare()); + this->icont().lower_bound_range(k, KeyNodeCompare(key_comp())); return std::pair(iterator(ret.first), iterator(ret.second)); } @@ -1378,7 +1378,7 @@ class tree lower_bound_range(const K& k) const { std::pair 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(ret.first), const_iterator(ret.second)); }