From a070ce232528694f05266214fc07afcdab4e701d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 14 Jun 2024 13:38:50 +0200 Subject: [PATCH] Fixes #245 ("flat_tree::insert ordered range doesn't assert sorting") --- include/boost/container/detail/flat_tree.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp index 1547ad6..b356e94 100644 --- a/include/boost/container/detail/flat_tree.hpp +++ b/include/boost/container/detail/flat_tree.hpp @@ -954,6 +954,7 @@ class flat_tree template void insert_equal(ordered_range_t, InIt first, InIt last) { + BOOST_ASSERT((is_sorted)(first, last, this->priv_value_comp())); const bool value = boost::container::dtl:: has_member_function_callable_with_merge_unique::value; (flat_tree_merge_equal)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_()); @@ -962,6 +963,7 @@ class flat_tree template void insert_unique(ordered_unique_range_t, InIt first, InIt last) { + BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); const bool value = boost::container::dtl:: has_member_function_callable_with_merge_unique::value; (flat_tree_merge_unique)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_());