1010#ifndef _LIBCPP___FLAT_MAP_FLAT_MULTISET_H
1111#define _LIBCPP___FLAT_MAP_FLAT_MULTISET_H
1212
13- #include " utils.h "
13+ #include < __algorithm/equal_range.h >
1414#include < __algorithm/lexicographical_compare_three_way.h>
15+ #include < __algorithm/lower_bound.h>
1516#include < __algorithm/min.h>
1617#include < __algorithm/ranges_equal.h>
17- #include < __algorithm/ranges_equal_range.h>
1818#include < __algorithm/ranges_inplace_merge.h>
1919#include < __algorithm/ranges_is_sorted.h>
20- #include < __algorithm/ranges_lower_bound.h>
21- #include < __algorithm/ranges_partition_point.h>
2220#include < __algorithm/ranges_sort.h>
2321#include < __algorithm/ranges_unique.h>
24- #include < __algorithm/ranges_upper_bound.h>
2522#include < __algorithm/remove_if.h>
23+ #include < __algorithm/upper_bound.h>
2624#include < __assert>
2725#include < __compare/synth_three_way.h>
2826#include < __concepts/convertible_to.h>
@@ -523,43 +521,47 @@ class flat_multiset {
523521 }
524522
525523 _LIBCPP_HIDE_FROM_ABI iterator lower_bound (const key_type& __x) {
526- return iterator (ranges::lower_bound (std::as_const (__keys_), __x, __compare_));
524+ const auto & __keys = __keys_;
525+ return iterator (std::lower_bound (__keys.begin (), __keys.end (), __x, __compare_));
527526 }
528527
529528 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound (const key_type& __x) const {
530- return const_iterator (ranges ::lower_bound (__keys_, __x, __compare_));
529+ return const_iterator (std ::lower_bound (__keys_. begin (), __keys_. end () , __x, __compare_));
531530 }
532531
533532 template <class _Kp >
534533 requires __is_transparent_v<_Compare>
535534 _LIBCPP_HIDE_FROM_ABI iterator lower_bound (const _Kp& __x) {
536- return iterator (ranges::lower_bound (std::as_const (__keys_), __x, __compare_));
535+ const auto & __keys = __keys_;
536+ return iterator (std::lower_bound (__keys.begin (), __keys.end (), __x, __compare_));
537537 }
538538
539539 template <class _Kp >
540540 requires __is_transparent_v<_Compare>
541541 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound (const _Kp& __x) const {
542- return const_iterator (ranges ::lower_bound (__keys_, __x, __compare_));
542+ return const_iterator (std ::lower_bound (__keys_. begin (), __keys_. end () , __x, __compare_));
543543 }
544544
545545 _LIBCPP_HIDE_FROM_ABI iterator upper_bound (const key_type& __x) {
546- return iterator (ranges::upper_bound (std::as_const (__keys_), __x, __compare_));
546+ const auto & __keys = __keys_;
547+ return iterator (std::upper_bound (__keys.begin (), __keys.end (), __x, __compare_));
547548 }
548549
549550 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound (const key_type& __x) const {
550- return const_iterator (ranges ::upper_bound (__keys_, __x, __compare_));
551+ return const_iterator (std ::upper_bound (__keys_. begin (), __keys_. end () , __x, __compare_));
551552 }
552553
553554 template <class _Kp >
554555 requires __is_transparent_v<_Compare>
555556 _LIBCPP_HIDE_FROM_ABI iterator upper_bound (const _Kp& __x) {
556- return iterator (ranges::upper_bound (std::as_const (__keys_), __x, __compare_));
557+ const auto & __keys = __keys_;
558+ return iterator (std::upper_bound (__keys.begin (), __keys.end (), __x, __compare_));
557559 }
558560
559561 template <class _Kp >
560562 requires __is_transparent_v<_Compare>
561563 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound (const _Kp& __x) const {
562- return const_iterator (ranges ::upper_bound (__keys_, __x, __compare_));
564+ return const_iterator (std ::upper_bound (__keys_. begin (), __keys_. end () , __x, __compare_));
563565 }
564566
565567 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range (const key_type& __x) {
@@ -630,7 +632,7 @@ class flat_multiset {
630632 // |
631633 // hint
632634 // We want to insert "2" after the last existing "2"
633- __hint = ranges ::upper_bound (begin (), __hint, __key, __compare_);
635+ __hint = std ::upper_bound (begin (), __hint, __key, __compare_);
634636 } else {
635637 _LIBCPP_ASSERT_INTERNAL (!__prev_larger && __next_smaller, " this means that the multiset is not sorted" );
636638
@@ -641,7 +643,7 @@ class flat_multiset {
641643 // |
642644 // hint
643645 // We want to insert "2" before the first existing "2"
644- __hint = ranges ::lower_bound (__hint, end (), __key, __compare_);
646+ __hint = std ::lower_bound (__hint, end (), __key, __compare_);
645647 }
646648 return __flat_set_utils::__emplace_exact_pos (*this , __hint, std::forward<_Kp>(__key));
647649 }
@@ -658,8 +660,9 @@ class flat_multiset {
658660
659661 template <class _Self , class _Kp >
660662 _LIBCPP_HIDE_FROM_ABI static auto __equal_range_impl (_Self&& __self, const _Kp& __key) {
661- using __iter = _If<is_const_v<__libcpp_remove_reference_t <_Self>>, const_iterator, iterator>;
662- auto [__key_first, __key_last] = ranges::equal_range (__self.__keys_ , __key, __self.__compare_ );
663+ using __iter = _If<is_const_v<__libcpp_remove_reference_t <_Self>>, const_iterator, iterator>;
664+ auto [__key_first, __key_last] =
665+ std::equal_range (__self.__keys_ .begin (), __self.__keys_ .end (), __key, __self.__compare_ );
663666 return std::make_pair (__iter (__key_first), __iter (__key_last));
664667 }
665668
0 commit comments