aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp
diff options
context:
space:
mode:
authorAlexSm <alex@ydb.tech>2023-12-27 23:31:58 +0100
committerGitHub <noreply@github.com>2023-12-27 23:31:58 +0100
commitd67bfb4b4b7549081543e87a31bc6cb5c46ac973 (patch)
tree8674f2f1570877cb653e7ddcff37ba00288de15a /contrib/libs/cxxsupp
parent1f6bef05ed441c3aa2d565ac792b26cded704ac7 (diff)
downloadydb-d67bfb4b4b7549081543e87a31bc6cb5c46ac973.tar.gz
Import libs 4 (#758)
Diffstat (limited to 'contrib/libs/cxxsupp')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h181
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h44
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h84
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h9
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h7
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h15
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h44
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h36
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h79
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h12
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h49
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h17
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/push_heap.h17
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h97
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h1
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h51
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h1
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h77
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h82
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h98
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h88
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h134
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h120
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h8
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h116
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h120
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h88
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h85
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h176
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h159
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h23
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h111
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h102
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h19
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h13
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h268
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h12
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h95
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h75
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h76
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__chrono/day.h23
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__config19
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__debug_utils/randomize_range.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h332
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h1
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h7
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h118
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h681
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/unicode.h339
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h8
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h6
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h39
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__locale9
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h12
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h98
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h53
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h78
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h24
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/algorithm151
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/bit3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/chrono12
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/format9
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/limits4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/ostream84
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/version2
-rw-r--r--contrib/libs/cxxsupp/libcxx/ya.make7
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h202
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h53
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h112
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h46
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h29
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h82
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h135
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h178
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h81
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h127
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h82
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h45
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h408
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h350
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h114
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h81
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h73
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h130
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h86
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h134
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h190
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h81
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h289
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h185
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h440
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h174
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h35
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/cassert24
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex28
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/cfenv81
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes257
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/ciso64624
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/complex1496
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/complex.h40
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/coroutine52
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp47
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/csignal57
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h120
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/forward_list1791
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h266
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/iostream89
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/list2422
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/numbers133
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/queue955
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/ranges269
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/set1564
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h48
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/span658
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h235
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h42
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd5
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/typeindex115
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map2619
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set1807
-rw-r--r--contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h7
137 files changed, 3613 insertions, 20642 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h
index cbfcd3c1ec..f30f55be64 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h
@@ -55,7 +55,7 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
_ForwardIterator __mp1 = __m;
return pair<_ForwardIterator, _ForwardIterator>
(
- _VSTD::__lower_bound_impl<_StdIterOps>(__first, __m, __value, __comp, __proj),
+ _VSTD::__lower_bound_impl<_ClassicAlgPolicy>(__first, __m, __value, __comp, __proj),
_VSTD::__upper_bound<_Compare>(++__mp1, __last, __value, __comp)
);
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h
index 0220c09397..65e9f29b1c 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h
@@ -11,8 +11,16 @@
#define _LIBCPP___ALGORITHM_FIND_END_OF_H
#include <__algorithm/comp.h>
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/search.h>
#include <__config>
+#include <__functional/identity.h>
+#include <__iterator/advance.h>
#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__iterator/reverse_iterator.h>
+#include <__utility/pair.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -20,35 +28,52 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred, forward_iterator_tag,
- forward_iterator_tag) {
+template <
+ class _AlgPolicy,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_Iter1, _Iter1> __find_end_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ forward_iterator_tag,
+ forward_iterator_tag) {
// modeled after search algorithm
- _ForwardIterator1 __r = __last1; // __last1 is the "default" answer
+ _Iter1 __match_first = _IterOps<_AlgPolicy>::next(__first1, __last1); // __last1 is the "default" answer
+ _Iter1 __match_last = __match_first;
if (__first2 == __last2)
- return __r;
+ return pair<_Iter1, _Iter1>(__match_last, __match_last);
while (true) {
while (true) {
- if (__first1 == __last1) // if source exhausted return last correct answer
- return __r; // (or __last1 if never found)
- if (__pred(*__first1, *__first2))
+ if (__first1 == __last1) // if source exhausted return last correct answer (or __last1 if never found)
+ return pair<_Iter1, _Iter1>(__match_first, __match_last);
+ if (std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
break;
++__first1;
}
// *__first1 matches *__first2, now match elements after here
- _ForwardIterator1 __m1 = __first1;
- _ForwardIterator2 __m2 = __first2;
+ _Iter1 __m1 = __first1;
+ _Iter2 __m2 = __first2;
while (true) {
if (++__m2 == __last2) { // Pattern exhaused, record answer and search for another one
- __r = __first1;
+ __match_first = __first1;
+ __match_last = ++__m1;
++__first1;
break;
}
if (++__m1 == __last1) // Source exhausted, return last answer
- return __r;
- if (!__pred(*__m1, *__m2)) // mismatch, restart with a new __first
+ return pair<_Iter1, _Iter1>(__match_first, __match_last);
+ // mismatch, restart with a new __first
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2)))
{
++__first1;
break;
@@ -57,33 +82,52 @@ _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 __find_end(_ForwardIterator1 __f
}
}
-template <class _BinaryPredicate, class _BidirectionalIterator1, class _BidirectionalIterator2>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator1 __find_end(
- _BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, _BidirectionalIterator2 __first2,
- _BidirectionalIterator2 __last2, _BinaryPredicate __pred, bidirectional_iterator_tag, bidirectional_iterator_tag) {
+template <
+ class _IterOps,
+ class _Pred,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter1 __find_end(
+ _Iter1 __first1,
+ _Sent1 __sent1,
+ _Iter2 __first2,
+ _Sent2 __sent2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ bidirectional_iterator_tag,
+ bidirectional_iterator_tag) {
+ auto __last1 = _IterOps::next(__first1, __sent1);
+ auto __last2 = _IterOps::next(__first2, __sent2);
// modeled after search algorithm (in reverse)
if (__first2 == __last2)
return __last1; // Everything matches an empty sequence
- _BidirectionalIterator1 __l1 = __last1;
- _BidirectionalIterator2 __l2 = __last2;
+ _Iter1 __l1 = __last1;
+ _Iter2 __l2 = __last2;
--__l2;
while (true) {
// Find last element in sequence 1 that matchs *(__last2-1), with a mininum of loop checks
while (true) {
if (__first1 == __l1) // return __last1 if no element matches *__first2
return __last1;
- if (__pred(*--__l1, *__l2))
+ if (std::__invoke(__pred, std::__invoke(__proj1, *--__l1), std::__invoke(__proj2, *__l2)))
break;
}
// *__l1 matches *__l2, now match elements before here
- _BidirectionalIterator1 __m1 = __l1;
- _BidirectionalIterator2 __m2 = __l2;
+ _Iter1 __m1 = __l1;
+ _Iter2 __m2 = __l2;
while (true) {
if (__m2 == __first2) // If pattern exhausted, __m1 is the answer (works for 1 element pattern)
return __m1;
if (__m1 == __first1) // Otherwise if source exhaused, pattern not found
return __last1;
- if (!__pred(*--__m1, *--__m2)) // if there is a mismatch, restart with a new __l1
+
+ // if there is a mismatch, restart with a new __l1
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2)))
{
break;
} // else there is a match, check next elements
@@ -91,37 +135,53 @@ _LIBCPP_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator1 __find_end(
}
}
-template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1 __find_end(
- _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag) {
- typedef typename iterator_traits<_RandomAccessIterator1>::difference_type _D1;
- typedef typename iterator_traits<_RandomAccessIterator2>::difference_type _D2;
+template <
+ class _AlgPolicy,
+ class _Pred,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end(
+ _Iter1 __first1,
+ _Sent1 __sent1,
+ _Iter2 __first2,
+ _Sent2 __sent2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ random_access_iterator_tag,
+ random_access_iterator_tag) {
+ typedef typename iterator_traits<_Iter1>::difference_type _D1;
+ auto __last1 = _IterOps<_AlgPolicy>::next(__first1, __sent1);
+ auto __last2 = _IterOps<_AlgPolicy>::next(__first2, __sent2);
// Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern
- _D2 __len2 = __last2 - __first2;
+ auto __len2 = __last2 - __first2;
if (__len2 == 0)
return __last1;
- _D1 __len1 = __last1 - __first1;
+ auto __len1 = __last1 - __first1;
if (__len1 < __len2)
return __last1;
- const _RandomAccessIterator1 __s = __first1 + _D1(__len2 - 1); // End of pattern match can't go before here
- _RandomAccessIterator1 __l1 = __last1;
- _RandomAccessIterator2 __l2 = __last2;
+ const _Iter1 __s = __first1 + _D1(__len2 - 1); // End of pattern match can't go before here
+ _Iter1 __l1 = __last1;
+ _Iter2 __l2 = __last2;
--__l2;
while (true) {
while (true) {
if (__s == __l1)
return __last1;
- if (__pred(*--__l1, *__l2))
+ if (std::__invoke(__pred, std::__invoke(__proj1, *--__l1), std::__invoke(__proj2, *__l2)))
break;
}
- _RandomAccessIterator1 __m1 = __l1;
- _RandomAccessIterator2 __m2 = __l2;
+ _Iter1 __m1 = __l1;
+ _Iter2 __m2 = __l2;
while (true) {
if (__m2 == __first2)
return __m1;
// no need to check range on __m1 because __s guarantees we have enough source
- if (!__pred(*--__m1, *--__m2)) {
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(*--__m2))) {
break;
}
}
@@ -129,20 +189,39 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1 __find_end(
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1
-find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred) {
- return _VSTD::__find_end<_BinaryPredicate&>(
- __first1, __last1, __first2, __last2, __pred, typename iterator_traits<_ForwardIterator1>::iterator_category(),
- typename iterator_traits<_ForwardIterator2>::iterator_category());
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+_ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate& __pred) {
+ auto __proj = __identity();
+ return std::__find_end_impl<_ClassicAlgPolicy>(
+ __first1,
+ __last1,
+ __first2,
+ __last2,
+ __pred,
+ __proj,
+ __proj,
+ typename iterator_traits<_ForwardIterator1>::iterator_category(),
+ typename iterator_traits<_ForwardIterator2>::iterator_category())
+ .first;
+}
+
+template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
+ return std::__find_end_classic(__first1, __last1, __first2, __last2, __pred);
}
template <class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1
-find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
- typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
- typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
- return _VSTD::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
+ using __v1 = typename iterator_traits<_ForwardIterator1>::value_type;
+ using __v2 = typename iterator_traits<_ForwardIterator2>::value_type;
+ return std::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h
index 58919ddbae..7369786eeb 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h
@@ -11,6 +11,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/lower_bound.h>
#include <__algorithm/min.h>
#include <__algorithm/move.h>
@@ -21,7 +22,6 @@
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/reverse_iterator.h>
-#include <__utility/swap.h>
#include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -53,7 +53,7 @@ public:
bool operator()(const _T1& __x, const _T2& __y) {return __p_(__y, __x);}
};
-template <class _Compare, class _InputIterator1, class _InputIterator2,
+template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2,
class _OutputIterator>
void __half_inplace_merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
@@ -63,25 +63,26 @@ void __half_inplace_merge(_InputIterator1 __first1, _InputIterator1 __last1,
{
if (__first2 == __last2)
{
+ // TODO(alg-policy): pass `_AlgPolicy` once it's supported by `move`.
_VSTD::move(__first1, __last1, __result);
return;
}
if (__comp(*__first2, *__first1))
{
- *__result = _VSTD::move(*__first2);
+ *__result = _IterOps<_AlgPolicy>::__iter_move(__first2);
++__first2;
}
else
{
- *__result = _VSTD::move(*__first1);
+ *__result = _IterOps<_AlgPolicy>::__iter_move(__first1);
++__first1;
}
}
// __first2 through __last2 are already in the right spot.
}
-template <class _Compare, class _BidirectionalIterator>
+template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
void
__buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
_Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1,
@@ -95,30 +96,32 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
{
value_type* __p = __buff;
for (_BidirectionalIterator __i = __first; __i != __middle; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
- ::new ((void*)__p) value_type(_VSTD::move(*__i));
- _VSTD::__half_inplace_merge<_Compare>(__buff, __p, __middle, __last, __first, __comp);
+ ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
+ std::__half_inplace_merge<_AlgPolicy, _Compare>(__buff, __p, __middle, __last, __first, __comp);
}
else
{
value_type* __p = __buff;
for (_BidirectionalIterator __i = __middle; __i != __last; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
- ::new ((void*)__p) value_type(_VSTD::move(*__i));
+ ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
typedef reverse_iterator<_BidirectionalIterator> _RBi;
typedef reverse_iterator<value_type*> _Rv;
typedef __invert<_Compare> _Inverted;
- _VSTD::__half_inplace_merge<_Inverted>(_Rv(__p), _Rv(__buff),
+ std::__half_inplace_merge<_AlgPolicy, _Inverted>(_Rv(__p), _Rv(__buff),
_RBi(__middle), _RBi(__first),
_RBi(__last), _Inverted(__comp));
}
}
-template <class _Compare, class _BidirectionalIterator>
+template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
void
__inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
_Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1,
typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
typename iterator_traits<_BidirectionalIterator>::value_type* __buff, ptrdiff_t __buff_size)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
while (true)
{
@@ -126,7 +129,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
if (__len2 == 0)
return;
if (__len1 <= __buff_size || __len2 <= __buff_size)
- return _VSTD::__buffered_inplace_merge<_Compare>
+ return std::__buffered_inplace_merge<_AlgPolicy, _Compare>
(__first, __middle, __last, __comp, __len1, __len2, __buff);
// shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
for (; true; ++__first, (void) --__len1)
@@ -153,35 +156,37 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
{ // __len >= 1, __len2 >= 2
__len21 = __len2 / 2;
__m2 = __middle;
- _VSTD::advance(__m2, __len21);
+ _Ops::advance(__m2, __len21);
__m1 = _VSTD::__upper_bound<_Compare>(__first, __middle, *__m2, __comp);
- __len11 = _VSTD::distance(__first, __m1);
+ __len11 = _Ops::distance(__first, __m1);
}
else
{
if (__len1 == 1)
{ // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1
// It is known *__first > *__middle
- swap(*__first, *__middle);
+ _Ops::iter_swap(__first, __middle);
return;
}
// __len1 >= 2, __len2 >= 1
__len11 = __len1 / 2;
__m1 = __first;
- _VSTD::advance(__m1, __len11);
+ _Ops::advance(__m1, __len11);
__m2 = std::lower_bound(__middle, __last, *__m1, __comp);
- __len21 = _VSTD::distance(__middle, __m2);
+ __len21 = _Ops::distance(__middle, __m2);
}
difference_type __len12 = __len1 - __len11; // distance(__m1, __middle)
difference_type __len22 = __len2 - __len21; // distance(__m2, __last)
// [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
// swap middle two partitions
+ // TODO(alg-policy): pass `_AlgPolicy` once it's supported by `rotate`.
__middle = _VSTD::rotate(__m1, __middle, __m2);
// __len12 and __len21 now have swapped meanings
// merge smaller range with recursive call and larger with tail recursion elimination
if (__len11 + __len21 < __len12 + __len22)
{
- _VSTD::__inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
+ std::__inplace_merge<_AlgPolicy, _Compare>(
+ __first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
// _VSTD::__inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
__first = __middle;
__middle = __m2;
@@ -190,7 +195,8 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
}
else
{
- _VSTD::__inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
+ std::__inplace_merge<_AlgPolicy, _Compare>(
+ __middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
// _VSTD::__inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
__last = __middle;
__middle = __m1;
@@ -217,7 +223,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
_LIBCPP_SUPPRESS_DEPRECATED_POP
unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
+ return _VSTD::__inplace_merge<_ClassicAlgPolicy, _Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
__buf.first, __buf.second);
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h
index 3d86f35f59..b27217d5d8 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h
@@ -6,14 +6,20 @@
//
//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___ALGORIHTM_ITERATOR_OPERATIONS_H
-#define _LIBCPP___ALGORIHTM_ITERATOR_OPERATIONS_H
+#ifndef _LIBCPP___ALGORITHM_ITERATOR_OPERATIONS_H
+#define _LIBCPP___ALGORITHM_ITERATOR_OPERATIONS_H
+#include <__algorithm/iter_swap.h>
#include <__config>
#include <__iterator/advance.h>
#include <__iterator/distance.h>
+#include <__iterator/iter_move.h>
+#include <__iterator/iter_swap.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/next.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -21,35 +27,91 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _AlgPolicy> struct _IterOps;
+
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-struct _RangesIterOps {
+struct _RangeAlgPolicy {};
+
+template <>
+struct _IterOps<_RangeAlgPolicy> {
static constexpr auto advance = ranges::advance;
static constexpr auto distance = ranges::distance;
+ static constexpr auto __iter_move = ranges::iter_move;
+ static constexpr auto iter_swap = ranges::iter_swap;
static constexpr auto next = ranges::next;
+ static constexpr auto __advance_to = ranges::advance;
};
+
#endif
-struct _StdIterOps {
+struct _ClassicAlgPolicy {};
- template <class _Iterator, class _Distance>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 void advance(_Iterator& __iter, _Distance __count) {
- return std::advance(__iter, __count);
+template <>
+struct _IterOps<_ClassicAlgPolicy> {
+
+ // advance
+ template <class _Iter, class _Distance>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+ static void advance(_Iter& __iter, _Distance __count) {
+ std::advance(__iter, __count);
}
- template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
- typename iterator_traits<_Iterator>::difference_type distance(_Iterator __first, _Iterator __last) {
+ // distance
+ template <class _Iter>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+ static typename iterator_traits<_Iter>::difference_type distance(_Iter __first, _Iter __last) {
return std::distance(__first, __last);
}
+ // iter_move
+ template <class _Iter>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+ // Declaring the return type is necessary for C++03, so we basically mirror what `decltype(auto)` would deduce.
+ static __enable_if_t<
+ is_reference<typename iterator_traits<__uncvref_t<_Iter> >::reference>::value,
+ typename remove_reference< typename iterator_traits<__uncvref_t<_Iter> >::reference >::type&&>
+ __iter_move(_Iter&& __i) {
+ return std::move(*std::forward<_Iter>(__i));
+ }
+
+ template <class _Iter>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+ // Declaring the return type is necessary for C++03, so we basically mirror what `decltype(auto)` would deduce.
+ static __enable_if_t<
+ !is_reference<typename iterator_traits<__uncvref_t<_Iter> >::reference>::value,
+ typename iterator_traits<__uncvref_t<_Iter> >::reference>
+ __iter_move(_Iter&& __i) {
+ return *std::forward<_Iter>(__i);
+ }
+
+ // iter_swap
+ template <class _Iter1, class _Iter2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+ static void iter_swap(_Iter1&& __a, _Iter2&& __b) {
+ std::iter_swap(std::forward<_Iter1>(__a), std::forward<_Iter2>(__b));
+ }
+
+ // next
template <class _Iterator>
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
_Iterator next(_Iterator, _Iterator __last) {
return __last;
}
+ template <class _Iter>
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
+ __uncvref_t<_Iter> next(_Iter&& __it,
+ typename iterator_traits<__uncvref_t<_Iter> >::difference_type __n = 1){
+ return std::next(std::forward<_Iter>(__it), __n);
+ }
+
+ template <class _Iter>
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
+ void __advance_to(_Iter& __first, _Iter __last) {
+ __first = __last;
+ }
};
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP___ALGORIHTM_ITERATOR_OPERATIONS_H
+#endif // _LIBCPP___ALGORITHM_ITERATOR_OPERATIONS_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h
index 431ac92a64..2c92f71526 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h
@@ -19,6 +19,7 @@
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__type_traits/is_callable.h>
+#include <__type_traits/remove_reference.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -27,15 +28,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _IterOps, class _Iter, class _Sent, class _Type, class _Proj, class _Comp>
+template <class _AlgPolicy, class _Iter, class _Sent, class _Type, class _Proj, class _Comp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
_Iter __lower_bound_impl(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
- auto __len = _IterOps::distance(__first, __last);
+ auto __len = _IterOps<_AlgPolicy>::distance(__first, __last);
while (__len != 0) {
auto __l2 = std::__half_positive(__len);
_Iter __m = __first;
- _IterOps::advance(__m, __l2);
+ _IterOps<_AlgPolicy>::advance(__m, __l2);
if (std::__invoke(__comp, std::__invoke(__proj, *__m), __value)) {
__first = ++__m;
__len -= __l2 + 1;
@@ -52,7 +53,7 @@ _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last,
static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
"The comparator has to be callable");
auto __proj = std::__identity();
- return std::__lower_bound_impl<_StdIterOps>(__first, __last, __value, __comp, __proj);
+ return std::__lower_bound_impl<_ClassicAlgPolicy>(__first, __last, __value, __comp, __proj);
}
template <class _ForwardIterator, class _Tp>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h
index bc39d82bf9..bf9dd96756 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h
@@ -11,6 +11,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/sift_down.h>
#include <__config>
#include <__iterator/iterator_traits.h>
@@ -22,7 +23,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
using _CompRef = typename __comp_ref_type<_Compare>::type;
@@ -33,7 +34,7 @@ void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
if (__n > 1) {
// start from the first parent, there is no need to consider children
for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) {
- std::__sift_down<_CompRef>(__first, __comp_ref, __n, __first + __start);
+ std::__sift_down<_AlgPolicy, _CompRef>(__first, __comp_ref, __n, __first + __start);
}
}
}
@@ -41,7 +42,7 @@ void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
template <class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
- std::__make_heap(std::move(__first), std::move(__last), __comp);
+ std::__make_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h
index 6d8ebfd3d9..64fc3dfb6a 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h
@@ -27,6 +27,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
+template <class _Pred, class _Proj>
+_LIBCPP_HIDE_FROM_ABI constexpr static
+decltype(auto) __make_projected_pred(_Pred& __pred, _Proj& __proj) {
+ if constexpr (same_as<decay_t<_Proj>, identity> && !is_member_pointer_v<decay_t<_Pred>>) {
+ // Avoid creating the lambda and just use the pristine predicate -- for certain algorithms, this would enable
+ // optimizations that rely on the type of the predicate.
+ return __pred;
+
+ } else {
+ return [&](auto&& __x) {
+ return std::invoke(__pred, std::invoke(__proj, std::forward<decltype(__x)>(__x)));
+ };
+ }
+}
+
template <class _Comp, class _Proj>
_LIBCPP_HIDE_FROM_ABI constexpr static
decltype(auto) __make_projected_comp(_Comp& __comp, _Proj& __proj) {
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h
index 129833d42b..17b242c341 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h
@@ -12,7 +12,11 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_callable.h>
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -20,28 +24,38 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
-__min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
- "std::min_element requires a ForwardIterator");
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- if (__comp(*__i, *__first))
- __first = __i;
- }
+template <class _Comp, class _Iter, class _Sent, class _Proj>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
+ if (__first == __last)
return __first;
+
+ _Iter __i = __first;
+ while (++__i != __last)
+ if (std::__invoke(__comp, std::__invoke(__proj, *__i), std::__invoke(__proj, *__first)))
+ __first = __i;
+
+ return __first;
+}
+
+template <class _Comp, class _Iter, class _Sent>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) {
+ auto __proj = __identity();
+ return std::__min_element<_Comp>(std::move(__first), std::move(__last), __comp, __proj);
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__min_element<_Comp_ref>(__first, __last, __comp);
+ static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
+ "std::min_element requires a ForwardIterator");
+ static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
+ "The comparator has to be callable");
+
+ typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+ return std::__min_element<_Comp_ref>(std::move(__first), std::move(__last), __comp);
}
template <class _ForwardIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
index c7cdef5be8..688398dee8 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
@@ -11,13 +11,13 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/sort.h>
#include <__config>
#include <__debug>
#include <__debug_utils/randomize_range.h>
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>
-#include <__utility/swap.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -41,10 +41,12 @@ __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
}
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 void
__nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
// _Compare is known to be a reference type
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
const difference_type __limit = 7;
@@ -60,24 +62,24 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
return;
case 2:
if (__comp(*--__last, *__first))
- swap(*__first, *__last);
+ _Ops::iter_swap(__first, __last);
return;
case 3:
{
_RandomAccessIterator __m = __first;
- _VSTD::__sort3<_Compare>(__first, ++__m, --__last, __comp);
+ std::__sort3<_AlgPolicy, _Compare>(__first, ++__m, --__last, __comp);
return;
}
}
if (__len <= __limit)
{
- _VSTD::__selection_sort<_Compare>(__first, __last, __comp);
+ std::__selection_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
return;
}
// __len > __limit >= 3
_RandomAccessIterator __m = __first + __len/2;
_RandomAccessIterator __lm1 = __last;
- unsigned __n_swaps = _VSTD::__sort3<_Compare>(__first, __m, --__lm1, __comp);
+ unsigned __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, --__lm1, __comp);
// *__m is median
// partition [__first, __m) < *__m and *__m <= [__m, __last)
// (this inhibits tossing elements equivalent to __m around unnecessarily)
@@ -90,7 +92,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
{
// *__first == *__m, *__first doesn't go in first part
if (_VSTD::__nth_element_find_guard<_Compare>(__i, __j, __m, __comp)) {
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
} else {
// *__first == *__m, *__m <= all other elements
@@ -102,7 +104,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
if (__i == __j) {
return; // [__first, __last) all equivalent elements
} else if (__comp(*__first, *__i)) {
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
++__i;
break;
@@ -121,7 +123,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
;
if (__i >= __j)
break;
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
++__i;
}
@@ -152,7 +154,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
;
if (__i >= __j)
break;
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
// It is known that __m != __j
// If __m just moved, follow it
@@ -164,7 +166,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
// [__first, __i) < *__m and *__m <= [__i, __last)
if (__i != __m && __comp(*__m, *__i))
{
- swap(*__i, *__m);
+ _Ops::iter_swap(__i, __m);
++__n_swaps;
}
// [__first, __i) < *__i and *__i <= [__i+1, __last)
@@ -220,21 +222,21 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
}
}
-template <class _RandomAccessIterator, class _Compare>
+template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
_Compare& __comp) {
if (__nth == __last)
return;
- std::__debug_randomize_range(__first, __last);
+ std::__debug_randomize_range<_AlgPolicy>(__first, __last);
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
- std::__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
+ std::__nth_element<_AlgPolicy, _Comp_ref>(__first, __nth, __last, __comp);
- std::__debug_randomize_range(__first, __nth);
+ std::__debug_randomize_range<_AlgPolicy>(__first, __nth);
if (__nth != __last) {
- std::__debug_randomize_range(++__nth, __last);
+ std::__debug_randomize_range<_AlgPolicy>(++__nth, __last);
}
}
@@ -242,7 +244,7 @@ template <class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
_Compare __comp) {
- std::__nth_element_impl(std::move(__first), std::move(__nth), std::move(__last), __comp);
+ std::__nth_element_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__nth), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h
index e008c0c996..cb6887e39b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h
@@ -11,6 +11,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_heap.h>
#include <__algorithm/sift_down.h>
#include <__algorithm/sort_heap.h>
@@ -18,7 +19,8 @@
#include <__debug>
#include <__debug_utils/randomize_range.h>
#include <__iterator/iterator_traits.h>
-#include <__utility/swap.h>
+#include <__utility/move.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -26,24 +28,55 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 void
-__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
- _Compare __comp)
-{
- if (__first == __middle)
- return;
- _VSTD::__make_heap<_Compare>(__first, __middle, __comp);
- typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
- for (_RandomAccessIterator __i = __middle; __i != __last; ++__i)
- {
- if (__comp(*__i, *__first))
- {
- swap(*__i, *__first);
- _VSTD::__sift_down<_Compare>(__first, __comp, __len, __first);
- }
- }
- _VSTD::__sort_heap<_Compare>(__first, __middle, __comp);
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
+_RandomAccessIterator __partial_sort_impl(
+ _RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare __comp) {
+ if (__first == __middle) {
+ return _IterOps<_AlgPolicy>::next(__middle, __last);
+ }
+
+ std::__make_heap<_AlgPolicy, _Compare>(__first, __middle, __comp);
+
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
+ _RandomAccessIterator __i = __middle;
+ for (; __i != __last; ++__i)
+ {
+ if (__comp(*__i, *__first))
+ {
+ _IterOps<_AlgPolicy>::iter_swap(__i, __first);
+ std::__sift_down<_AlgPolicy, _Compare>(__first, __comp, __len, __first);
+ }
+
+ }
+ std::__sort_heap<_AlgPolicy, _Compare>(std::move(__first), std::move(__middle), __comp);
+
+ return __i;
+}
+
+// TODO(ranges): once `ranges::shuffle` is implemented, remove this helper and make `__debug_randomize_range` support
+// sentinels.
+template <class _AlgPolicy, class _RandomAccessIterator, class _Sentinel>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+void __maybe_randomize(_RandomAccessIterator __first, _Sentinel __last) {
+ std::__debug_randomize_range<_AlgPolicy>(__first, _IterOps<_AlgPolicy>::next(__first, __last));
+}
+
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
+_RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last,
+ _Compare& __comp) {
+ if (__first == __middle)
+ return _IterOps<_AlgPolicy>::next(__middle, __last);
+
+ std::__maybe_randomize<_AlgPolicy>(__first, __last);
+
+ using _Comp_ref = typename __comp_ref_type<_Compare>::type;
+ auto __last_iter = std::__partial_sort_impl<_AlgPolicy, _Comp_ref>(__first, __middle, __last, __comp);
+
+ std::__maybe_randomize<_AlgPolicy>(__middle, __last);
+
+ return __last_iter;
}
template <class _RandomAccessIterator, class _Compare>
@@ -52,10 +85,10 @@ void
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
_Compare __comp)
{
- std::__debug_randomize_range(__first, __last);
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- _VSTD::__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
- std::__debug_randomize_range(__middle, __last);
+ static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
+ static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
+
+ (void)std::__partial_sort<_ClassicAlgPolicy>(std::move(__first), std::move(__middle), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h
index 7ed1e538e9..3556764e65 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h
@@ -11,6 +11,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_heap.h>
#include <__algorithm/sift_down.h>
#include <__algorithm/sort_heap.h>
@@ -23,7 +24,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _InputIterator, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _InputIterator, class _RandomAccessIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
__partial_sort_copy(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
@@ -33,15 +34,15 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last,
{
for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
*__r = *__first;
- _VSTD::__make_heap<_Compare>(__result_first, __r, __comp);
+ std::__make_heap<_AlgPolicy, _Compare>(__result_first, __r, __comp);
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
for (; __first != __last; ++__first)
if (__comp(*__first, *__result_first))
{
*__result_first = *__first;
- _VSTD::__sift_down<_Compare>(__result_first, __comp, __len, __result_first);
+ std::__sift_down<_AlgPolicy, _Compare>(__result_first, __comp, __len, __result_first);
}
- _VSTD::__sort_heap<_Compare>(__result_first, __r, __comp);
+ std::__sort_heap<_AlgPolicy, _Compare>(__result_first, __r, __comp);
}
return __r;
}
@@ -53,7 +54,8 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
{
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
+ return std::__partial_sort_copy<_ClassicAlgPolicy, _Comp_ref>(
+ __first, __last, __result_first, __result_last, __comp);
}
template <class _InputIterator, class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h
index 73d94831ed..60b4e290eb 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h
@@ -9,9 +9,12 @@
#ifndef _LIBCPP___ALGORITHM_PARTITION_H
#define _LIBCPP___ALGORITHM_PARTITION_H
+#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__iterator/iterator_traits.h>
-#include <__utility/swap.h>
+#include <__utility/move.h>
+#include <__utility/pair.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -19,40 +22,45 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Predicate, class _ForwardIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
-__partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag)
+template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator>
+__partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag)
{
while (true)
{
if (__first == __last)
- return __first;
+ return std::make_pair(std::move(__first), std::move(__first));
if (!__pred(*__first))
break;
++__first;
}
- for (_ForwardIterator __p = __first; ++__p != __last;)
+
+ _ForwardIterator __p = __first;
+ while (++__p != __last)
{
if (__pred(*__p))
{
- swap(*__first, *__p);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __p);
++__first;
}
}
- return __first;
+ return std::make_pair(std::move(__first), std::move(__p));
}
-template <class _Predicate, class _BidirectionalIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator
-__partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
+template <class _Predicate, class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
+_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_BidirectionalIterator, _BidirectionalIterator>
+__partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred,
bidirectional_iterator_tag)
{
+ _BidirectionalIterator __original_last = _IterOps<_AlgPolicy>::next(__first, __sentinel);
+ _BidirectionalIterator __last = __original_last;
+
while (true)
{
while (true)
{
if (__first == __last)
- return __first;
+ return std::make_pair(std::move(__first), std::move(__original_last));
if (!__pred(*__first))
break;
++__first;
@@ -60,20 +68,29 @@ __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Pred
do
{
if (__first == --__last)
- return __first;
+ return std::make_pair(std::move(__first), std::move(__original_last));
} while (!__pred(*__last));
- swap(*__first, *__last);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
++__first;
}
}
+template <class _AlgPolicy, class _ForwardIterator, class _Sentinel, class _Predicate, class _IterCategory>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+pair<_ForwardIterator, _ForwardIterator> __partition(
+ _ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) {
+ return std::__partition_impl<__uncvref_t<_Predicate>&, _AlgPolicy>(
+ std::move(__first), std::move(__last), __pred, __iter_category);
+}
+
template <class _ForwardIterator, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
_ForwardIterator
partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
{
- return _VSTD::__partition<_Predicate&>(
- __first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
+ using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
+ auto __result = std::__partition<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred, _IterCategory());
+ return __result.first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h
index cadda81f6c..870af50c13 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h
@@ -11,12 +11,14 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/push_heap.h>
#include <__algorithm/sift_down.h>
#include <__assert>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -24,7 +26,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
@@ -35,17 +37,17 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
if (__len > 1) {
- value_type __top = std::move(*__first); // create a hole at __first
- _RandomAccessIterator __hole = std::__floyd_sift_down<_CompRef>(__first, __comp_ref, __len);
+ value_type __top = _IterOps<_AlgPolicy>::__iter_move(__first); // create a hole at __first
+ _RandomAccessIterator __hole = std::__floyd_sift_down<_AlgPolicy, _CompRef>(__first, __comp_ref, __len);
--__last;
if (__hole == __last) {
*__hole = std::move(__top);
} else {
- *__hole = std::move(*__last);
+ *__hole = _IterOps<_AlgPolicy>::__iter_move(__last);
++__hole;
*__last = std::move(__top);
- std::__sift_up<_CompRef>(__first, __hole, __comp_ref, __hole - __first);
+ std::__sift_up<_AlgPolicy, _CompRef>(__first, __hole, __comp_ref, __hole - __first);
}
}
}
@@ -53,8 +55,11 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
template <class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+ static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
+ static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
+
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __last - __first;
- std::__pop_heap(std::move(__first), std::move(__last), __comp, __len);
+ std::__pop_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp, __len);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/push_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/push_heap.h
index 1e3eec373d..716670b767 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/push_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/push_heap.h
@@ -11,9 +11,11 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -21,7 +23,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
@@ -32,9 +34,9 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
_RandomAccessIterator __ptr = __first + __len;
if (__comp(*__ptr, *--__last)) {
- value_type __t(std::move(*__last));
+ value_type __t(_IterOps<_AlgPolicy>::__iter_move(__last));
do {
- *__last = std::move(*__ptr);
+ *__last = _IterOps<_AlgPolicy>::__iter_move(__ptr);
__last = __ptr;
if (__len == 0)
break;
@@ -47,18 +49,21 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
}
-template <class _RandomAccessIterator, class _Compare>
+template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
void __push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
using _CompRef = typename __comp_ref_type<_Compare>::type;
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __last - __first;
- std::__sift_up<_CompRef>(std::move(__first), std::move(__last), __comp, __len);
+ std::__sift_up<_AlgPolicy, _CompRef>(std::move(__first), std::move(__last), __comp, __len);
}
template <class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
- std::__push_heap(std::move(__first), std::move(__last), __comp);
+ static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
+ static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
+
+ std::__push_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h
index 68359fb138..6da68834aa 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h
@@ -35,7 +35,7 @@ struct __fn {
indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
_LIBCPP_HIDE_FROM_ABI constexpr
bool operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp, __proj);
+ auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first));
}
@@ -45,7 +45,7 @@ struct __fn {
bool operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
- auto __ret = std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp, __proj);
+ auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first));
}
};
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h
index 846e318851..7ce4a76ba9 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h
@@ -30,7 +30,7 @@ struct __fn {
template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent>
_LIBCPP_HIDE_FROM_ABI constexpr
_Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
- if constexpr(random_access_iterator<_Iter>) {
+ if constexpr(random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
return ranges::fill_n(__first, __last - __first, __value);
} else {
for (; __first != __last; ++__first)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h
new file mode 100644
index 0000000000..270b006498
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_FIND_END_H
+#define _LIBCPP___ALGORITHM_RANGES_FIND_END_H
+
+#include <__algorithm/find_end.h>
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/ranges_iterator_concept.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/iterator_traits.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/subrange.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __find_end {
+struct __fn {
+ template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
+ forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
+ class _Pred = ranges::equal_to,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1,
+ _Iter2 __first2, _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
+ __first1,
+ __last1,
+ __first2,
+ __last2,
+ __pred,
+ __proj1,
+ __proj2,
+ __iterator_concept<_Iter1>(),
+ __iterator_concept<_Iter2>());
+ return {__ret.first, __ret.second};
+ }
+
+ template <forward_range _Range1,
+ forward_range _Range2,
+ class _Pred = ranges::equal_to,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_subrange_t<_Range1> operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ __pred,
+ __proj1,
+ __proj2,
+ __iterator_concept<iterator_t<_Range1>>(),
+ __iterator_concept<iterator_t<_Range2>>());
+ return {__ret.first, __ret.second};
+ }
+};
+} // namespace __find_end
+
+inline namespace __cpo {
+ inline constexpr auto find_end = __find_end::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h
index ddf8b047cd..013afbd193 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h
@@ -18,7 +18,6 @@
#include <__iterator/iterator_traits.h>
#include <__iterator/projected.h>
#include <__ranges/concepts.h>
-#include <__ranges/dangling.h>
#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h
new file mode 100644
index 0000000000..3323119317
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_iterator_concept.h
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
+#define _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
+
+#include <__config>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _IterMaybeQualified>
+consteval auto __get_iterator_concept() {
+ using _Iter = __uncvref_t<_IterMaybeQualified>;
+
+ if constexpr (contiguous_iterator<_Iter>)
+ return contiguous_iterator_tag();
+ else if constexpr (random_access_iterator<_Iter>)
+ return random_access_iterator_tag();
+ else if constexpr (bidirectional_iterator<_Iter>)
+ return bidirectional_iterator_tag();
+ else if constexpr (forward_iterator<_Iter>)
+ return forward_iterator_tag();
+ else if constexpr (input_iterator<_Iter>)
+ return input_iterator_tag();
+}
+
+template <class _Iter>
+using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
+
+} // namespace ranges
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h
index a73470465c..1a9ae204a1 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h
@@ -39,7 +39,7 @@ struct __fn {
indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
_LIBCPP_HIDE_FROM_ABI constexpr
_Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- return std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp, __proj);
+ return std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
}
template <forward_range _Range, class _Type, class _Proj = identity,
@@ -49,7 +49,7 @@ struct __fn {
const _Type& __value,
_Comp __comp = {},
_Proj __proj = {}) const {
- return std::__lower_bound_impl<_RangesIterOps>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj);
+ return std::__lower_bound_impl<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj);
}
};
} // namespace __lower_bound
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h
index fd488dc11a..8eabdd12cd 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_MAKE_HEAP_H
#define _LIBCPP___ALGORITHM_RANGES_MAKE_HEAP_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_heap.h>
#include <__algorithm/make_projected.h>
#include <__concepts/same_as.h>
@@ -45,7 +46,7 @@ struct __fn {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__make_heap(std::move(__first), __last_iter, __projected_comp);
+ std::__make_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h
index ae82dceb9a..26f95fe3a6 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h
@@ -30,6 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
+// TODO(ranges): `ranges::min_element` can now simply delegate to `std::__min_element`.
template <class _Ip, class _Sp, class _Proj, class _Comp>
_LIBCPP_HIDE_FROM_ABI static constexpr
_Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h
index 2a929eacb8..b15eb816b9 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_NTH_ELEMENT_H
#define _LIBCPP___ALGORITHM_RANGES_NTH_ELEMENT_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_projected.h>
#include <__algorithm/nth_element.h>
#include <__config>
@@ -44,7 +45,7 @@ struct __fn {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__nth_element_impl(std::move(__first), std::move(__nth), __last_iter, __projected_comp);
+ std::__nth_element_impl<_RangeAlgPolicy>(std::move(__first), std::move(__nth), __last_iter, __projected_comp);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h
new file mode 100644
index 0000000000..5e82bc6fcc
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H
+#define _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H
+
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/make_projected.h>
+#include <__algorithm/partial_sort.h>
+#include <__concepts/same_as.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__iterator/projected.h>
+#include <__iterator/sortable.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __partial_sort {
+
+struct __fn {
+ template <class _Iter, class _Sent, class _Comp, class _Proj>
+ _LIBCPP_HIDE_FROM_ABI constexpr static
+ _Iter __partial_sort_fn_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
+ return std::__partial_sort<_RangeAlgPolicy>(std::move(__first), std::move(__middle), __last, __projected_comp);
+ }
+
+ template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
+ requires sortable<_Iter, _Comp, _Proj>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ _Iter operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ return __partial_sort_fn_impl(std::move(__first), std::move(__middle), std::move(__last), __comp, __proj);
+ }
+
+ template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
+ requires sortable<iterator_t<_Range>, _Comp, _Proj>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_iterator_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __middle, _Comp __comp = {},
+ _Proj __proj = {}) const {
+ return __partial_sort_fn_impl(ranges::begin(__r), std::move(__middle), ranges::end(__r), __comp, __proj);
+ }
+};
+
+} // namespace __partial_sort
+
+inline namespace __cpo {
+ inline constexpr auto partial_sort = __partial_sort::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h
new file mode 100644
index 0000000000..60bee699d9
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_PARTITION_H
+#define _LIBCPP___ALGORITHM_RANGES_PARTITION_H
+
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/make_projected.h>
+#include <__algorithm/partition.h>
+#include <__algorithm/ranges_iterator_concept.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/permutable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/subrange.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __partition {
+
+struct __fn {
+
+ template <class _Iter, class _Sent, class _Proj, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI static constexpr
+ subrange<__uncvref_t<_Iter>> __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
+ auto&& __projected_pred = ranges::__make_projected_pred(__pred, __proj);
+ auto __result = std::__partition<_RangeAlgPolicy>(
+ std::move(__first), std::move(__last), __projected_pred, __iterator_concept<_Iter>());
+
+ return {std::move(__result.first), std::move(__result.second)};
+ }
+
+ template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ return __partition_fn_impl(__first, __last, __pred, __proj);
+ }
+
+ template <forward_range _Range, class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ requires permutable<iterator_t<_Range>>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ return __partition_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
+ }
+
+};
+
+} // namespace __partition
+
+inline namespace __cpo {
+ inline constexpr auto partition = __partition::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h
new file mode 100644
index 0000000000..7201a8cbfe
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
+#define _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
+
+#include <__algorithm/in_out_out_result.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/move.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _InIter, class _OutIter1, class _OutIter2>
+using partition_copy_result = in_out_out_result<_InIter, _OutIter1, _OutIter2>;
+
+namespace __partition_copy {
+
+struct __fn {
+
+ // TODO(ranges): delegate to the classic algorithm.
+ template <class _InIter, class _Sent, class _OutIter1, class _OutIter2, class _Proj, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ static partition_copy_result<
+ __uncvref_t<_InIter>, __uncvref_t<_OutIter1>, __uncvref_t<_OutIter2>
+ > __partition_copy_fn_impl( _InIter&& __first, _Sent&& __last, _OutIter1&& __out_true, _OutIter2&& __out_false,
+ _Pred& __pred, _Proj& __proj) {
+ for (; __first != __last; ++__first) {
+ if (std::invoke(__pred, std::invoke(__proj, *__first))) {
+ *__out_true = *__first;
+ ++__out_true;
+
+ } else {
+ *__out_false = *__first;
+ ++__out_false;
+ }
+ }
+
+ return {std::move(__first), std::move(__out_true), std::move(__out_false)};
+ }
+
+ template <input_iterator _InIter, sentinel_for<_InIter> _Sent,
+ weakly_incrementable _OutIter1, weakly_incrementable _OutIter2,
+ class _Proj = identity, indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
+ requires indirectly_copyable<_InIter, _OutIter1> && indirectly_copyable<_InIter, _OutIter2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ partition_copy_result<_InIter, _OutIter1, _OutIter2>
+ operator()(_InIter __first, _Sent __last, _OutIter1 __out_true, _OutIter2 __out_false,
+ _Pred __pred, _Proj __proj = {}) const {
+ return __partition_copy_fn_impl(
+ std::move(__first), std::move(__last), std::move(__out_true), std::move(__out_false), __pred, __proj);
+ }
+
+ template <input_range _Range, weakly_incrementable _OutIter1, weakly_incrementable _OutIter2,
+ class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ requires indirectly_copyable<iterator_t<_Range>, _OutIter1> && indirectly_copyable<iterator_t<_Range>, _OutIter2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ partition_copy_result<borrowed_iterator_t<_Range>, _OutIter1, _OutIter2>
+ operator()(_Range&& __range, _OutIter1 __out_true, _OutIter2 __out_false, _Pred __pred, _Proj __proj = {}) const {
+ return __partition_copy_fn_impl(
+ ranges::begin(__range), ranges::end(__range), std::move(__out_true), std::move(__out_false), __pred, __proj);
+ }
+
+};
+
+} // namespace __partition_copy
+
+inline namespace __cpo {
+ inline constexpr auto partition_copy = __partition_copy::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h
new file mode 100644
index 0000000000..6614a0bb50
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H
+#define _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H
+
+#include <__algorithm/half_positive.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __partition_point {
+
+struct __fn {
+
+ // TODO(ranges): delegate to the classic algorithm.
+ template <class _Iter, class _Sent, class _Proj, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ static _Iter __partition_point_fn_impl(_Iter&& __first, _Sent&& __last, _Pred& __pred, _Proj& __proj) {
+ auto __len = ranges::distance(__first, __last);
+
+ while (__len != 0) {
+ auto __half_len = std::__half_positive(__len);
+ auto __mid = ranges::next(__first, __half_len);
+
+ if (std::invoke(__pred, std::invoke(__proj, *__mid))) {
+ __first = ++__mid;
+ __len -= __half_len + 1;
+
+ } else {
+ __len = __half_len;
+ }
+ }
+
+ return __first;
+ }
+
+ template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ return __partition_point_fn_impl(std::move(__first), std::move(__last), __pred, __proj);
+ }
+
+ template <forward_range _Range, class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_iterator_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ return __partition_point_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
+ }
+
+};
+
+} // namespace __partition_point
+
+inline namespace __cpo {
+ inline constexpr auto partition_point = __partition_point::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h
index d0b8314e5b..92df6119d3 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_POP_HEAP_H
#define _LIBCPP___ALGORITHM_RANGES_POP_HEAP_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_projected.h>
#include <__algorithm/pop_heap.h>
#include <__concepts/same_as.h>
@@ -46,7 +47,7 @@ struct __fn {
auto __len = __last_iter - __first;
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__pop_heap(std::move(__first), __last_iter, __projected_comp, __len);
+ std::__pop_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp, __len);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h
index e46ad19cfe..4c41b00128 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_PUSH_HEAP_H
#define _LIBCPP___ALGORITHM_RANGES_PUSH_HEAP_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_projected.h>
#include <__algorithm/push_heap.h>
#include <__concepts/same_as.h>
@@ -45,7 +46,7 @@ struct __fn {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__push_heap(std::move(__first), __last_iter, __projected_comp);
+ std::__push_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h
new file mode 100644
index 0000000000..0564bbe1f8
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h
@@ -0,0 +1,134 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_SEARCH_H
+#define _LIBCPP___ALGORITHM_RANGES_SEARCH_H
+
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/search.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/advance.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/size.h>
+#include <__ranges/subrange.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __search {
+struct __fn {
+ template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
+ _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2) {
+ if constexpr (sized_sentinel_for<_Sent2, _Iter2>) {
+ auto __size2 = ranges::distance(__first2, __last2);
+ if (__size2 == 0)
+ return {__first1, __first1};
+
+ if constexpr (sized_sentinel_for<_Sent1, _Iter1>) {
+ auto __size1 = ranges::distance(__first1, __last1);
+ if (__size1 < __size2) {
+ ranges::advance(__first1, __last1);
+ return {__first1, __first1};
+ }
+
+ if constexpr (random_access_iterator<_Iter1> && random_access_iterator<_Iter2>) {
+ auto __ret = std::__search_random_access_impl<_RangeAlgPolicy>(
+ __first1, __last1, __first2, __last2, __pred, __proj1, __proj2, __size1, __size2);
+ return {__ret.first, __ret.second};
+ }
+ }
+ }
+
+ auto __ret =
+ std::__search_forward_impl<_RangeAlgPolicy>(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
+ return {__ret.first, __ret.second};
+ }
+
+ template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
+ forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
+ class _Pred = ranges::equal_to,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1,
+ _Iter2 __first2, _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ return __ranges_search_impl(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
+ }
+
+ template <forward_range _Range1,
+ forward_range _Range2,
+ class _Pred = ranges::equal_to,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_subrange_t<_Range1> operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __first1 = ranges::begin(__range1);
+ if constexpr (sized_range<_Range2>) {
+ auto __size2 = ranges::size(__range2);
+ if (__size2 == 0)
+ return {__first1, __first1};
+ if constexpr (sized_range<_Range1>) {
+ auto __size1 = ranges::size(__range1);
+ if (__size1 < __size2) {
+ ranges::advance(__first1, ranges::end(__range1));
+ return {__first1, __first1};
+ }
+ }
+ }
+
+ return __ranges_search_impl(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ __pred,
+ __proj1,
+ __proj2);
+ }
+
+};
+} // namespace __search
+
+inline namespace __cpo {
+ inline constexpr auto search = __search::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h
new file mode 100644
index 0000000000..29fdbfb1c7
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H
+#define _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H
+
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/search_n.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/advance.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/incrementable_traits.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/iterator_traits.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/size.h>
+#include <__ranges/subrange.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __search_n {
+struct __fn {
+
+ template <class _Iter1, class _Sent1, class _SizeT, class _Type, class _Pred, class _Proj>
+ _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_n_impl(
+ _Iter1 __first, _Sent1 __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) {
+ if (__count == 0)
+ return {__first, __first};
+
+ if constexpr (sized_sentinel_for<_Sent1, _Iter1>) {
+ auto __size = ranges::distance(__first, __last);
+ if (__size < __count) {
+ ranges::advance(__first, __last);
+ return {__first, __first};
+ }
+
+ if constexpr (random_access_iterator<_Iter1>) {
+ auto __ret = __search_n_random_access_impl<_RangeAlgPolicy>(__first, __last,
+ __count,
+ __value,
+ __pred,
+ __proj,
+ __size);
+ return {std::move(__ret.first), std::move(__ret.second)};
+ }
+ }
+
+ auto __ret = std::__search_n_forward_impl<_RangeAlgPolicy>(__first, __last,
+ __count,
+ __value,
+ __pred,
+ __proj);
+ return {std::move(__ret.first), std::move(__ret.second)};
+ }
+
+ template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
+ class _Type,
+ class _Pred = ranges::equal_to,
+ class _Proj = identity>
+ requires indirectly_comparable<_Iter, const _Type*, _Pred, _Proj>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ subrange<_Iter> operator()(_Iter __first, _Sent __last,
+ iter_difference_t<_Iter> __count,
+ const _Type& __value,
+ _Pred __pred = {},
+ _Proj __proj = _Proj{}) const {
+ return __ranges_search_n_impl(__first, __last, __count, __value, __pred, __proj);
+ }
+
+ template <forward_range _Range, class _Type, class _Pred = ranges::equal_to, class _Proj = identity>
+ requires indirectly_comparable<iterator_t<_Range>, const _Type*, _Pred, _Proj>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_subrange_t<_Range> operator()(_Range&& __range,
+ range_difference_t<_Range> __count,
+ const _Type& __value,
+ _Pred __pred = {},
+ _Proj __proj = {}) const {
+ auto __first = ranges::begin(__range);
+ if (__count <= 0)
+ return {__first, __first};
+ if constexpr (sized_range<_Range>) {
+ auto __size1 = ranges::size(__range);
+ if (__size1 < static_cast<range_size_t<_Range>>(__count)) {
+ ranges::advance(__first, ranges::end(__range));
+ return {__first, __first};
+ }
+ }
+
+ return __ranges_search_n_impl(ranges::begin(__range), ranges::end(__range), __count, __value, __pred, __proj);
+ }
+};
+} // namespace __search_n
+
+inline namespace __cpo {
+ inline constexpr auto search_n = __search_n::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h
index feb0fe4222..331ff061d3 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h
@@ -59,14 +59,14 @@ struct __fn {
_Comp __comp = {},
_Proj1 __proj1 = {},
_Proj2 __proj2 = {}) const {
- auto __ret = std::__set_intersection<_RangesIterOps>(
+ auto __ret = std::__set_intersection<_RangeAlgPolicy>(
std::move(__first1),
std::move(__last1),
std::move(__first2),
std::move(__last2),
std::move(__result),
ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.in1), std::move(__ret.in2), std::move(__ret.out)};
+ return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
}
template <
@@ -93,14 +93,14 @@ struct __fn {
_Comp __comp = {},
_Proj1 __proj1 = {},
_Proj2 __proj2 = {}) const {
- auto __ret = std::__set_intersection<_RangesIterOps>(
+ auto __ret = std::__set_intersection<_RangeAlgPolicy>(
ranges::begin(__range1),
ranges::end(__range1),
ranges::begin(__range2),
ranges::end(__range2),
std::move(__result),
ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.in1), std::move(__ret.in2), std::move(__ret.out)};
+ return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
}
};
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h
new file mode 100644
index 0000000000..f45c5dca6e
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
+#define _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
+
+#include <__algorithm/in_in_out_result.h>
+#include <__algorithm/make_projected.h>
+#include <__algorithm/set_symmetric_difference.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/mergeable.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _InIter1, class _InIter2, class _OutIter>
+using set_symmetric_difference_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
+
+namespace __set_symmetric_difference {
+
+struct __fn {
+ template <
+ input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<_InIter1, _InIter2, _OutIter> operator()(
+ _InIter1 __first1,
+ _Sent1 __last1,
+ _InIter2 __first2,
+ _Sent2 __last2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __ret = std::__set_symmetric_difference(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ ranges::__make_projected_comp(__comp, __proj1, __proj2));
+ return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
+ }
+
+ template <
+ input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<
+ iterator_t<_Range1>,
+ iterator_t<_Range2>,
+ _OutIter,
+ _Comp,
+ _Proj1,
+ _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<borrowed_iterator_t<_Range1>,
+ borrowed_iterator_t<_Range2>,
+ _OutIter>
+ operator()(
+ _Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __ret = std::__set_symmetric_difference(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ std::move(__result),
+ ranges::__make_projected_comp(__comp, __proj1, __proj2));
+ return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
+ }
+};
+
+} // namespace __set_symmetric_difference
+
+inline namespace __cpo {
+ inline constexpr auto set_symmetric_difference = __set_symmetric_difference::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+#endif // _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h
new file mode 100644
index 0000000000..e4f28bb86a
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_SET_UNION_H
+#define _LIBCPP___ALGORITHM_RANGES_SET_UNION_H
+
+#include <__algorithm/in_in_out_result.h>
+#include <__algorithm/make_projected.h>
+#include <__algorithm/set_union.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/mergeable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _InIter1, class _InIter2, class _OutIter>
+using set_union_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
+
+namespace __set_union {
+
+struct __fn {
+ template <
+ input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<_InIter1, _InIter2, _OutIter> operator()(
+ _InIter1 __first1,
+ _Sent1 __last1,
+ _InIter2 __first2,
+ _Sent2 __last2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __ret = std::__set_union(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ ranges::__make_projected_comp(__comp, __proj1, __proj2));
+ return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
+ }
+
+ template <
+ input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<
+ iterator_t<_Range1>,
+ iterator_t<_Range2>,
+ _OutIter,
+ _Comp,
+ _Proj1,
+ _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<borrowed_iterator_t<_Range1>,
+ borrowed_iterator_t<_Range2>,
+ _OutIter>
+ operator()(
+ _Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ auto __ret = std::__set_union(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ std::move(__result),
+ ranges::__make_projected_comp(__comp, __proj1, __proj2));
+ return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
+ }
+};
+
+} // namespace __set_union
+
+inline namespace __cpo {
+ inline constexpr auto set_union = __set_union::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_SET_UNION_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h
index 8297940df2..ef14db6429 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_SORT_H
#define _LIBCPP___ALGORITHM_RANGES_SORT_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_projected.h>
#include <__algorithm/sort.h>
#include <__config>
@@ -44,7 +45,7 @@ struct __fn {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__sort_impl(std::move(__first), __last_iter, __projected_comp);
+ std::__sort_impl<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h
index c753e20c44..eb6a30dcd3 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_SORT_HEAP_H
#define _LIBCPP___ALGORITHM_RANGES_SORT_HEAP_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_projected.h>
#include <__algorithm/sort_heap.h>
#include <__concepts/same_as.h>
@@ -45,7 +46,7 @@ struct __fn {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__sort_heap(std::move(__first), __last_iter, __projected_comp);
+ std::__sort_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h
new file mode 100644
index 0000000000..27957db882
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
+#define _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
+
+#include <__algorithm/iterator_operations.h>
+#include <__algorithm/make_projected.h>
+#include <__algorithm/ranges_iterator_concept.h>
+#include <__algorithm/stable_partition.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__iterator/permutable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__ranges/subrange.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __stable_partition {
+
+struct __fn {
+
+ template <class _Iter, class _Sent, class _Proj, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI static
+ subrange<__uncvref_t<_Iter>> __stable_partition_fn_impl(
+ _Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
+ auto __last_iter = ranges::next(__first, __last);
+
+ auto&& __projected_pred = ranges::__make_projected_pred(__pred, __proj);
+ auto __result = std::__stable_partition<_RangeAlgPolicy>(
+ std::move(__first), __last_iter, __projected_pred, __iterator_concept<_Iter>());
+
+ return {std::move(__result), std::move(__last_iter)};
+ }
+
+ template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
+ requires permutable<_Iter>
+ _LIBCPP_HIDE_FROM_ABI
+ subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ return __stable_partition_fn_impl(__first, __last, __pred, __proj);
+ }
+
+ template <bidirectional_range _Range, class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ requires permutable<iterator_t<_Range>>
+ _LIBCPP_HIDE_FROM_ABI
+ borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ return __stable_partition_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
+ }
+
+};
+
+} // namespace __stable_partition
+
+inline namespace __cpo {
+ inline constexpr auto stable_partition = __stable_partition::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h
index 20e8404264..de48416a41 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_STABLE_SORT_H
#define _LIBCPP___ALGORITHM_RANGES_STABLE_SORT_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/make_projected.h>
#include <__algorithm/stable_sort.h>
#include <__config>
@@ -44,7 +45,7 @@ struct __fn {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = ranges::__make_projected_comp(__comp, __proj);
- std::__stable_sort_impl(std::move(__first), __last_iter, __projected_comp);
+ std::__stable_sort_impl<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
return __last_iter;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h
index 94b5269c86..3c63249248 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h
@@ -40,7 +40,7 @@ struct __fn {
return !std::invoke(__comp, __rhs, __lhs);
};
- return std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp_lhs_rhs_swapped, __proj);
+ return std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp_lhs_rhs_swapped, __proj);
}
template <forward_range _Range, class _Type, class _Proj = identity,
@@ -54,7 +54,7 @@ struct __fn {
return !std::invoke(__comp, __rhs, __lhs);
};
- return std::__lower_bound_impl<_RangesIterOps>(ranges::begin(__r),
+ return std::__lower_bound_impl<_RangeAlgPolicy>(ranges::begin(__r),
ranges::end(__r),
__value,
__comp_lhs_rhs_swapped,
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h
index c9ea5bad4c..fcf8444a65 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_ROTATE_H
#define _LIBCPP___ALGORITHM_ROTATE_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/move.h>
#include <__algorithm/move_backward.h>
#include <__algorithm/swap_ranges.h>
@@ -26,37 +27,40 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _ForwardIterator>
+template <class _AlgPolicy, class _ForwardIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
{
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- value_type __tmp = _VSTD::move(*__first);
+ value_type __tmp = _IterOps<_AlgPolicy>::__iter_move(__first);
+ // TODO(ranges): pass `_AlgPolicy` to `move`.
_ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first);
*__lm1 = _VSTD::move(__tmp);
return __lm1;
}
-template <class _BidirectionalIterator>
+template <class _AlgPolicy, class _BidirectionalIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator
__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
{
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ // TODO(ranges): pass `_AlgPolicy` to `prev`.
_BidirectionalIterator __lm1 = _VSTD::prev(__last);
- value_type __tmp = _VSTD::move(*__lm1);
+ value_type __tmp = _IterOps<_AlgPolicy>::__iter_move(__lm1);
+ // TODO(ranges): pass `_AlgPolicy` to `move_backward`.
_BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last);
*__first = _VSTD::move(__tmp);
return __fp1;
}
-template <class _ForwardIterator>
+template <class _AlgPolicy, class _ForwardIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX14 _ForwardIterator
__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
{
_ForwardIterator __i = __middle;
while (true)
{
- swap(*__first, *__i);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
++__first;
if (++__i == __last)
break;
@@ -69,7 +73,7 @@ __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIt
__i = __middle;
while (true)
{
- swap(*__first, *__i);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
++__first;
if (++__i == __last)
{
@@ -98,7 +102,7 @@ __algo_gcd(_Integral __x, _Integral __y)
return __x;
}
-template<typename _RandomAccessIterator>
+template <class _AlgPolicy, typename _RandomAccessIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX14 _RandomAccessIterator
__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
{
@@ -109,18 +113,19 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
const difference_type __m2 = __last - __middle;
if (__m1 == __m2)
{
+ // TODO(ranges): pass `_AlgPolicy` to `swap_ranges`.
_VSTD::swap_ranges(__first, __middle, __middle);
return __middle;
}
const difference_type __g = _VSTD::__algo_gcd(__m1, __m2);
for (_RandomAccessIterator __p = __first + __g; __p != __first;)
{
- value_type __t(_VSTD::move(*--__p));
+ value_type __t(_IterOps<_AlgPolicy>::__iter_move(--__p));
_RandomAccessIterator __p1 = __p;
_RandomAccessIterator __p2 = __p1 + __m1;
do
{
- *__p1 = _VSTD::move(*__p2);
+ *__p1 = _IterOps<_AlgPolicy>::__iter_move(__p2);
__p1 = __p2;
const difference_type __d = __last - __p2;
if (__m1 < __d)
@@ -133,54 +138,66 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
return __first + __m2;
}
-template <class _ForwardIterator>
+template <class _AlgPolicy, class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
-__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
+__rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
_VSTD::forward_iterator_tag)
{
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
if (is_trivially_move_assignable<value_type>::value)
{
- if (_VSTD::next(__first) == __middle)
- return _VSTD::__rotate_left(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
}
- return _VSTD::__rotate_forward(__first, __middle, __last);
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
-template <class _BidirectionalIterator>
+template <class _AlgPolicy, class _BidirectionalIterator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator
-__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
+__rotate_impl(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
bidirectional_iterator_tag)
{
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
if (is_trivially_move_assignable<value_type>::value)
{
- if (_VSTD::next(__first) == __middle)
- return _VSTD::__rotate_left(__first, __last);
- if (_VSTD::next(__middle) == __last)
- return _VSTD::__rotate_right(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__middle) == __last)
+ return std::__rotate_right<_AlgPolicy>(__first, __last);
}
- return _VSTD::__rotate_forward(__first, __middle, __last);
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
-template <class _RandomAccessIterator>
+template <class _AlgPolicy, class _RandomAccessIterator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator
-__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
+__rotate_impl(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
random_access_iterator_tag)
{
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
if (is_trivially_move_assignable<value_type>::value)
{
- if (_VSTD::next(__first) == __middle)
- return _VSTD::__rotate_left(__first, __last);
- if (_VSTD::next(__middle) == __last)
- return _VSTD::__rotate_right(__first, __last);
- return _VSTD::__rotate_gcd(__first, __middle, __last);
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__middle) == __last)
+ return std::__rotate_right<_AlgPolicy>(__first, __last);
+ return std::__rotate_gcd<_AlgPolicy>(__first, __middle, __last);
}
- return _VSTD::__rotate_forward(__first, __middle, __last);
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+}
+
+template <class _AlgPolicy, class _RandomAccessIterator, class _IterCategory>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+_RandomAccessIterator __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle,
+ _RandomAccessIterator __last, _IterCategory __iter_category) {
+ if (__first == __middle)
+ return __last;
+ if (__middle == __last)
+ return __first;
+
+ return std::__rotate_impl<_AlgPolicy>(std::move(__first), std::move(__middle), std::move(__last), __iter_category);
}
template <class _ForwardIterator>
@@ -188,12 +205,8 @@ inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
{
- if (__first == __middle)
- return __last;
- if (__middle == __last)
- return __first;
- return _VSTD::__rotate(__first, __middle, __last,
- typename iterator_traits<_ForwardIterator>::iterator_category());
+ return std::__rotate<_ClassicAlgPolicy>(__first, __middle, __last,
+ typename iterator_traits<_ForwardIterator>::iterator_category());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h
index d89ec2b1c5..4ead6cac82 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h
@@ -11,9 +11,15 @@
#define _LIBCPP___ALGORITHM_SEARCH_H
#include <__algorithm/comp.h>
+#include <__algorithm/iterator_operations.h>
#include <__config>
+#include <__functional/identity.h>
+#include <__iterator/advance.h>
+#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_callable.h>
#include <__utility/pair.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -21,31 +27,43 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
-pair<_ForwardIterator1, _ForwardIterator1>
- _LIBCPP_CONSTEXPR_AFTER_CXX11 __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred, forward_iterator_tag, forward_iterator_tag) {
+template <class _AlgPolicy,
+ class _Iter1, class _Sent1,
+ class _Iter2, class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
+ _Iter2 __first2, _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2) {
if (__first2 == __last2)
- return _VSTD::make_pair(__first1, __first1); // Everything matches an empty sequence
+ return std::make_pair(__first1, __first1); // Everything matches an empty sequence
while (true) {
// Find first element in sequence 1 that matchs *__first2, with a mininum of loop checks
while (true) {
- if (__first1 == __last1) // return __last1 if no element matches *__first2
- return _VSTD::make_pair(__last1, __last1);
- if (__pred(*__first1, *__first2))
+ if (__first1 == __last1) { // return __last1 if no element matches *__first2
+ _IterOps<_AlgPolicy>::__advance_to(__first1, __last1);
+ return std::make_pair(__first1, __first1);
+ }
+ if (std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
break;
++__first1;
}
// *__first1 matches *__first2, now match elements after here
- _ForwardIterator1 __m1 = __first1;
- _ForwardIterator2 __m2 = __first2;
+ _Iter1 __m1 = __first1;
+ _Iter2 __m2 = __first2;
while (true) {
if (++__m2 == __last2) // If pattern exhausted, __first1 is the answer (works for 1 element pattern)
- return _VSTD::make_pair(__first1, __m1);
- if (++__m1 == __last1) // Otherwise if source exhaused, pattern not found
- return _VSTD::make_pair(__last1, __last1);
- if (!__pred(*__m1, *__m2)) // if there is a mismatch, restart with a new __first1
+ return std::make_pair(__first1, ++__m1);
+ if (++__m1 == __last1) { // Otherwise if source exhaused, pattern not found
+ return std::make_pair(__m1, __m1);
+ }
+
+ // if there is a mismatch, restart with a new __first1
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2)))
{
++__first1;
break;
@@ -54,38 +72,42 @@ pair<_ForwardIterator1, _ForwardIterator1>
}
}
-template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_RandomAccessIterator1, _RandomAccessIterator1>
-__search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag,
- random_access_iterator_tag) {
- typedef typename iterator_traits<_RandomAccessIterator1>::difference_type _D1;
- typedef typename iterator_traits<_RandomAccessIterator2>::difference_type _D2;
- // Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern
- const _D2 __len2 = __last2 - __first2;
- if (__len2 == 0)
- return _VSTD::make_pair(__first1, __first1);
- const _D1 __len1 = __last1 - __first1;
- if (__len1 < __len2)
- return _VSTD::make_pair(__last1, __last1);
- const _RandomAccessIterator1 __s = __last1 - _D1(__len2 - 1); // Start of pattern match can't go beyond here
+template <class _AlgPolicy,
+ class _Iter1, class _Sent1,
+ class _Iter2, class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2,
+ class _DiffT1,
+ class _DiffT2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter1, _Iter1> __search_random_access_impl(_Iter1 __first1, _Sent1 __last1,
+ _Iter2 __first2, _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ _DiffT1 __size1,
+ _DiffT2 __size2) {
+ const _Iter1 __s = __first1 + __size1 - _DiffT1(__size2 - 1); // Start of pattern match can't go beyond here
while (true) {
while (true) {
- if (__first1 == __s)
- return _VSTD::make_pair(__last1, __last1);
- if (__pred(*__first1, *__first2))
+ if (__first1 == __s) {
+ _IterOps<_AlgPolicy>::__advance_to(__first1, __last1);
+ return std::make_pair(__first1, __first1);
+ }
+ if (std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
break;
++__first1;
}
- _RandomAccessIterator1 __m1 = __first1;
- _RandomAccessIterator2 __m2 = __first2;
+ _Iter1 __m1 = __first1;
+ _Iter2 __m2 = __first2;
while (true) {
if (++__m2 == __last2)
- return _VSTD::make_pair(__first1, __first1 + _D1(__len2));
+ return std::make_pair(__first1, __first1 + _DiffT1(__size2));
++__m1; // no need to check range on __m1 because __s guarantees we have enough source
- if (!__pred(*__m1, *__m2)) {
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2))) {
++__first1;
break;
}
@@ -93,22 +115,78 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _Rando
}
}
+template <class _Iter1, class _Sent1,
+ class _Iter2, class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
+ _Iter2 __first2, _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ __enable_if_t<__is_cpp17_random_access_iterator<_Iter1>::value
+ && __is_cpp17_random_access_iterator<_Iter2>::value>* = nullptr) {
+
+ auto __size2 = __last2 - __first2;
+ if (__size2 == 0)
+ return std::make_pair(__first1, __first1);
+
+ auto __size1 = __last1 - __first1;
+ if (__size1 < __size2) {
+ return std::make_pair(__last1, __last1);
+ }
+
+ return std::__search_random_access_impl<_ClassicAlgPolicy>(__first1, __last1,
+ __first2, __last2,
+ __pred,
+ __proj1,
+ __proj2,
+ __size1,
+ __size2);
+}
+
+template <class _Iter1, class _Sent1,
+ class _Iter2, class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
+ _Iter2 __first2, _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ __enable_if_t<__is_cpp17_forward_iterator<_Iter1>::value
+ && __is_cpp17_forward_iterator<_Iter2>::value
+ && !(__is_cpp17_random_access_iterator<_Iter1>::value
+ && __is_cpp17_random_access_iterator<_Iter2>::value)>* = nullptr) {
+ return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1,
+ __first2, __last2,
+ __pred,
+ __proj1,
+ __proj2);
+}
+
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1
-search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred) {
- return _VSTD::__search<_BinaryPredicate&>(
- __first1, __last1, __first2, __last2, __pred,
- typename iterator_traits<_ForwardIterator1>::iterator_category(),
- typename iterator_traits<_ForwardIterator2>::iterator_category()).first;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
+ static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
+ "BinaryPredicate has to be callable");
+ auto __proj = __identity();
+ return std::__search_impl(__first1, __last1, __first2, __last2, __pred, __proj, __proj).first;
}
template <class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1
-search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
- typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
- typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
- return _VSTD::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
+ using __v1 = typename iterator_traits<_ForwardIterator1>::value_type;
+ using __v2 = typename iterator_traits<_ForwardIterator2>::value_type;
+ return std::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
}
#if _LIBCPP_STD_VER > 14
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h
index c51701415b..ccb8e845f5 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h
@@ -11,8 +11,15 @@
#define _LIBCPP___ALGORITHM_SEARCH_N_H
#include <__algorithm/comp.h>
+#include <__algorithm/iterator_operations.h>
#include <__config>
+#include <__functional/identity.h>
+#include <__iterator/advance.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
+#include <__ranges/concepts.h>
+#include <__utility/pair.h>
#include <type_traits> // __convert_to_integral
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -21,30 +28,39 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator __search_n(_ForwardIterator __first, _ForwardIterator __last,
- _Size __count, const _Tp& __value, _BinaryPredicate __pred,
- forward_iterator_tag) {
+template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
+ _SizeT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj) {
if (__count <= 0)
- return __first;
+ return std::make_pair(__first, __first);
while (true) {
- // Find first element in sequence that matchs __value_, with a mininum of loop checks
+ // Find first element in sequence that matchs __value, with a mininum of loop checks
while (true) {
- if (__first == __last) // return __last if no element matches __value_
- return __last;
- if (__pred(*__first, __value))
+ if (__first == __last) { // return __last if no element matches __value
+ _IterOps<_AlgPolicy>::__advance_to(__first, __last);
+ return std::make_pair(__first, __first);
+ }
+ if (std::__invoke(__pred, std::__invoke(__proj, *__first), __value))
break;
++__first;
}
- // *__first matches __value_, now match elements after here
- _ForwardIterator __m = __first;
- _Size __c(0);
+ // *__first matches __value, now match elements after here
+ _Iter __m = __first;
+ _SizeT __c(0);
while (true) {
if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
- return __first;
- if (++__m == __last) // Otherwise if source exhaused, pattern not found
- return __last;
- if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first
+ return std::make_pair(__first, ++__m);
+ if (++__m == __last) { // Otherwise if source exhaused, pattern not found
+ _IterOps<_AlgPolicy>::__advance_to(__first, __last);
+ return std::make_pair(__first, __first);
+ }
+
+ // if there is a mismatch, restart with a new __first
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value))
{
__first = __m;
++__first;
@@ -54,35 +70,44 @@ _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator __search_n(_ForwardIterator __fir
}
}
-template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator __search_n(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Size __count,
- const _Tp& __value, _BinaryPredicate __pred,
- random_access_iterator_tag) {
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- if (__count <= 0)
- return __first;
- _Size __len = static_cast<_Size>(__last - __first);
- if (__len < __count)
- return __last;
- const _RandomAccessIterator __s = __last - difference_type(__count - 1); // Start of pattern match can't go beyond here
+template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj, class _DiffT>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __last,
+ _SizeT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ _DiffT __size1) {
+ using difference_type = typename iterator_traits<_Iter>::difference_type;
+ if (__count == 0)
+ return std::make_pair(__first, __first);
+ if (__size1 < static_cast<_DiffT>(__count)) {
+ _IterOps<_AlgPolicy>::__advance_to(__first, __last);
+ return std::make_pair(__first, __first);
+ }
+
+ const auto __s = __first + __size1 - difference_type(__count - 1); // Start of pattern match can't go beyond here
while (true) {
- // Find first element in sequence that matchs __value_, with a mininum of loop checks
+ // Find first element in sequence that matchs __value, with a mininum of loop checks
while (true) {
- if (__first >= __s) // return __last if no element matches __value_
- return __last;
- if (__pred(*__first, __value))
+ if (__first >= __s) { // return __last if no element matches __value
+ _IterOps<_AlgPolicy>::__advance_to(__first, __last);
+ return std::make_pair(__first, __first);
+ }
+ if (std::__invoke(__pred, std::__invoke(__proj, *__first), __value))
break;
++__first;
}
// *__first matches __value_, now match elements after here
- _RandomAccessIterator __m = __first;
- _Size __c(0);
+ auto __m = __first;
+ _SizeT __c(0);
while (true) {
if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
- return __first;
- ++__m; // no need to check range on __m because __s guarantees we have enough source
- if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first
+ return std::make_pair(__first, __first + _DiffT(__count));
+ ++__m; // no need to check range on __m because __s guarantees we have enough source
+
+ // if there is a mismatch, restart with a new __first
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value))
{
__first = __m;
++__first;
@@ -92,19 +117,63 @@ _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator __search_n(_RandomAccessIter
}
}
+template <class _Iter, class _Sent,
+ class _DiffT,
+ class _Type,
+ class _Pred,
+ class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter, _Iter> __search_n_impl(_Iter __first, _Sent __last,
+ _DiffT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ __enable_if_t<__is_cpp17_random_access_iterator<_Iter>::value>* = nullptr) {
+ return std::__search_n_random_access_impl<_ClassicAlgPolicy>(__first, __last,
+ __count,
+ __value,
+ __pred,
+ __proj,
+ __last - __first);
+}
+
+template <class _Iter1, class _Sent1,
+ class _DiffT,
+ class _Type,
+ class _Pred,
+ class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+pair<_Iter1, _Iter1> __search_n_impl(_Iter1 __first, _Sent1 __last,
+ _DiffT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ __enable_if_t<__is_cpp17_forward_iterator<_Iter1>::value
+ && !__is_cpp17_random_access_iterator<_Iter1>::value>* = nullptr) {
+ return std::__search_n_forward_impl<_ClassicAlgPolicy>(__first, __last,
+ __count,
+ __value,
+ __pred,
+ __proj);
+}
+
template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator search_n(
- _ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value, _BinaryPredicate __pred) {
- return _VSTD::__search_n<_BinaryPredicate&>(
- __first, __last, _VSTD::__convert_to_integral(__count), __value, __pred,
- typename iterator_traits<_ForwardIterator>::iterator_category());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+_ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last,
+ _Size __count,
+ const _Tp& __value,
+ _BinaryPredicate __pred) {
+ static_assert(__is_callable<_BinaryPredicate, decltype(*__first), const _Tp&>::value,
+ "BinaryPredicate has to be callable");
+ auto __proj = __identity();
+ return std::__search_n_impl(__first, __last, std::__convert_to_integral(__count), __value, __pred, __proj).first;
}
template <class _ForwardIterator, class _Size, class _Tp>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
-search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+_ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) {
typedef typename iterator_traits<_ForwardIterator>::value_type __v;
- return _VSTD::search_n(__first, __last, _VSTD::__convert_to_integral(__count), __value, __equal_to<__v, _Tp>());
+ return std::search_n(__first, __last, std::__convert_to_integral(__count), __value, __equal_to<__v, _Tp>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h
index 837f9af01d..77cc83738d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h
@@ -14,6 +14,7 @@
#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -24,17 +25,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _InIter1, class _InIter2, class _OutIter>
struct __set_intersection_result {
- _InIter1 in1;
- _InIter2 in2;
- _OutIter out;
+ _InIter1 __in1_;
+ _InIter2 __in2_;
+ _OutIter __out_;
// need a constructor as C++03 aggregate init is hard
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
__set_intersection_result(_InIter1&& __in_iter1, _InIter2&& __in_iter2, _OutIter&& __out_iter)
- : in1(std::move(__in_iter1)), in2(std::move(__in_iter2)), out(std::move(__out_iter)) {}
+ : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {}
};
-template < class _IterOper, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter>
+template <class _AlgPolicy, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_intersection_result<_InIter1, _InIter2, _OutIter>
__set_intersection(
_InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) {
@@ -52,8 +53,8 @@ __set_intersection(
}
return __set_intersection_result<_InIter1, _InIter2, _OutIter>(
- _IterOper::next(std::move(__first1), std::move(__last1)),
- _IterOper::next(std::move(__first2), std::move(__last2)),
+ _IterOps<_AlgPolicy>::next(std::move(__first1), std::move(__last1)),
+ _IterOps<_AlgPolicy>::next(std::move(__first2), std::move(__last2)),
std::move(__result));
}
@@ -66,14 +67,14 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_i
_OutputIterator __result,
_Compare __comp) {
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return std::__set_intersection<_StdIterOps, _Comp_ref>(
+ return std::__set_intersection<_ClassicAlgPolicy, _Comp_ref>(
std::move(__first1),
std::move(__last1),
std::move(__first2),
std::move(__last2),
std::move(__result),
__comp)
- .out;
+ .__out_;
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -83,7 +84,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_i
_InputIterator2 __first2,
_InputIterator2 __last2,
_OutputIterator __result) {
- return std::__set_intersection<_StdIterOps>(
+ return std::__set_intersection<_ClassicAlgPolicy>(
std::move(__first1),
std::move(__last1),
std::move(__first2),
@@ -91,7 +92,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_i
std::move(__result),
__less<typename iterator_traits<_InputIterator1>::value_type,
typename iterator_traits<_InputIterator2>::value_type>())
- .out;
+ .__out_;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h
index 2dbfb35d7b..cd532ab580 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_symmetric_difference.h
@@ -14,6 +14,7 @@
#include <__algorithm/copy.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -21,55 +22,81 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator
-__set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- while (__first1 != __last1)
- {
- if (__first2 == __last2)
- return _VSTD::copy(__first1, __last1, __result);
- if (__comp(*__first1, *__first2))
- {
- *__result = *__first1;
- ++__result;
- ++__first1;
- }
- else
- {
- if (__comp(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__result;
- }
- else
- ++__first1;
- ++__first2;
- }
+template <class _InIter1, class _InIter2, class _OutIter>
+struct __set_symmetric_difference_result {
+ _InIter1 __in1_;
+ _InIter2 __in2_;
+ _OutIter __out_;
+
+ // need a constructor as C++03 aggregate init is hard
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+ __set_symmetric_difference_result(_InIter1&& __in_iter1, _InIter2&& __in_iter2, _OutIter&& __out_iter)
+ : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {}
+};
+
+template <class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>
+__set_symmetric_difference(
+ _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) {
+ while (__first1 != __last1) {
+ if (__first2 == __last2) {
+ auto __ret1 = std::__copy_impl(std::move(__first1), std::move(__last1), std::move(__result));
+ return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>(
+ std::move(__ret1.first), std::move(__first2), std::move((__ret1.second)));
+ }
+ if (__comp(*__first1, *__first2)) {
+ *__result = *__first1;
+ ++__result;
+ ++__first1;
+ } else {
+ if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__result;
+ } else {
+ ++__first1;
+ }
+ ++__first2;
}
- return _VSTD::copy(__first2, __last2, __result);
+ }
+ auto __ret2 = std::__copy_impl(std::move(__first2), std::move(__last2), std::move(__result));
+ return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>(
+ std::move(__first1), std::move(__ret2.first), std::move((__ret2.second)));
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-_OutputIterator
-set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_symmetric_difference(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+ return std::__set_symmetric_difference<_Comp_ref>(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ __comp)
+ .__out_;
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-_OutputIterator
-set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
-{
- return _VSTD::set_symmetric_difference(__first1, __last1, __first2, __last2, __result,
- __less<typename iterator_traits<_InputIterator1>::value_type,
- typename iterator_traits<_InputIterator2>::value_type>());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_symmetric_difference(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result) {
+ return std::set_symmetric_difference(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ __less<typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h
index 0ec6b09380..3bd4379801 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_union.h
@@ -14,6 +14,7 @@
#include <__algorithm/copy.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -21,50 +22,77 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator
-__set_union(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- return _VSTD::copy(__first1, __last1, __result);
- if (__comp(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- if (!__comp(*__first1, *__first2))
- ++__first2;
- *__result = *__first1;
- ++__first1;
- }
+template <class _InIter1, class _InIter2, class _OutIter>
+struct __set_union_result {
+ _InIter1 __in1_;
+ _InIter2 __in2_;
+ _OutIter __out_;
+
+ // need a constructor as C++03 aggregate init is hard
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+ __set_union_result(_InIter1&& __in_iter1, _InIter2&& __in_iter2, _OutIter&& __out_iter)
+ : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {}
+};
+
+template <class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 __set_union_result<_InIter1, _InIter2, _OutIter> __set_union(
+ _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) {
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2) {
+ auto __ret1 = std::__copy_impl(std::move(__first1), std::move(__last1), std::move(__result));
+ return __set_union_result<_InIter1, _InIter2, _OutIter>(
+ std::move(__ret1.first), std::move(__first2), std::move((__ret1.second)));
+ }
+ if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__first2;
+ } else {
+ if (!__comp(*__first1, *__first2)) {
+ ++__first2;
+ }
+ *__result = *__first1;
+ ++__first1;
}
- return _VSTD::copy(__first2, __last2, __result);
+ }
+ auto __ret2 = std::__copy_impl(std::move(__first2), std::move(__last2), std::move(__result));
+ return __set_union_result<_InIter1, _InIter2, _OutIter>(
+ std::move(__first1), std::move(__ret2.first), std::move((__ret2.second)));
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-_OutputIterator
-set_union(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- return _VSTD::__set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_union(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+ return std::__set_union<_Comp_ref>(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ __comp)
+ .__out_;
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-_OutputIterator
-set_union(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
-{
- return _VSTD::set_union(__first1, __last1, __first2, __last2, __result,
- __less<typename iterator_traits<_InputIterator1>::value_type,
- typename iterator_traits<_InputIterator2>::value_type>());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator set_union(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result) {
+ return std::set_union(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ __less<typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h
index 6c6ff5675d..0778815621 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h
@@ -9,11 +9,13 @@
#ifndef _LIBCPP___ALGORITHM_SHUFFLE_H
#define _LIBCPP___ALGORITHM_SHUFFLE_H
+#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__random/uniform_int_distribution.h>
-#include <__utility/swap.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
#include <cstddef>
#include <cstdint>
@@ -134,10 +136,8 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
}
#endif
-template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
- void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _UniformRandomNumberGenerator&& __g)
-{
+template <class _AlgPolicy, class _RandomAccessIterator, class _UniformRandomNumberGenerator>
+void __shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRandomNumberGenerator&& __g) {
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef uniform_int_distribution<ptrdiff_t> _Dp;
typedef typename _Dp::param_type _Pp;
@@ -149,11 +149,18 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
{
difference_type __i = __uid(__g, _Pp(0, __d));
if (__i != difference_type(0))
- swap(*__first, *(__first + __i));
+ _IterOps<_AlgPolicy>::iter_swap(__first, __first + __i);
}
}
}
+template <class _RandomAccessIterator, class _UniformRandomNumberGenerator>
+void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _UniformRandomNumberGenerator&& __g) {
+ std::__shuffle<_ClassicAlgPolicy>(
+ std::move(__first), std::move(__last), std::forward<_UniformRandomNumberGenerator>(__g));
+}
+
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h
index 0351a1c578..be2eb29dd5 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_SIFT_DOWN_H
#define _LIBCPP___ALGORITHM_SIFT_DOWN_H
+#include <__algorithm/iterator_operations.h>
#include <__assert>
#include <__config>
#include <__iterator/iterator_traits.h>
@@ -20,12 +21,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 void
__sift_down(_RandomAccessIterator __first, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len,
_RandomAccessIterator __start)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
// left-child of __start is at 2 * __start + 1
@@ -49,11 +52,11 @@ __sift_down(_RandomAccessIterator __first, _Compare __comp,
// we are, __start is larger than its largest child
return;
- value_type __top(_VSTD::move(*__start));
+ value_type __top(_Ops::__iter_move(__start));
do
{
// we are not in heap-order, swap the parent with its largest child
- *__start = _VSTD::move(*__child_i);
+ *__start = _Ops::__iter_move(__child_i);
__start = __child_i;
if ((__len - 2) / 2 < __child)
@@ -74,7 +77,7 @@ __sift_down(_RandomAccessIterator __first, _Compare __comp,
*__start = _VSTD::move(__top);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator
__floyd_sift_down(_RandomAccessIterator __first, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len)
@@ -97,7 +100,7 @@ __floyd_sift_down(_RandomAccessIterator __first, _Compare __comp,
}
// swap __hole with its largest child
- *__hole = std::move(*__child_i);
+ *__hole = _IterOps<_AlgPolicy>::__iter_move(__child_i);
__hole = __child_i;
// if __hole is now a leaf, we're done
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h
index 76a1821573..1ca2f1b817 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h
@@ -11,6 +11,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/min_element.h>
#include <__algorithm/partial_sort.h>
#include <__algorithm/unwrap_iter.h>
@@ -21,7 +22,6 @@
#include <__functional/operations.h>
#include <__functional/ranges_operations.h>
#include <__iterator/iterator_traits.h>
-#include <__utility/swap.h>
#include <climits>
#include <memory>
@@ -31,37 +31,85 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+// Wraps an algorithm policy tag and a comparator in a single struct, used to pass the policy tag around without
+// changing the number of template arguments (to keep the ABI stable). This is only used for the "range" policy tag.
+//
+// To create an object of this type, use `_WrapAlgPolicy<T, C>::type` -- see the specialization below for the rationale.
+template <class _PolicyT, class _CompT, class = void>
+struct _WrapAlgPolicy {
+ using type = _WrapAlgPolicy;
+
+ using _AlgPolicy = _PolicyT;
+ using _Comp = _CompT;
+ _Comp& __comp;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+ _WrapAlgPolicy(_Comp& __c) : __comp(__c) {}
+};
+
+// Specialization for the "classic" policy tag that avoids creating a struct and simply defines an alias for the
+// comparator. When unwrapping, a pristine comparator is always considered to have the "classic" tag attached. Passing
+// the pristine comparator where possible allows using template instantiations from the dylib.
+template <class _PolicyT, class _CompT>
+struct _WrapAlgPolicy<_PolicyT, _CompT, __enable_if_t<std::is_same<_PolicyT, _ClassicAlgPolicy>::value> > {
+ using type = _CompT;
+};
+
+// Unwraps a pristine functor (e.g. `std::less`) as if it were wrapped using `_WrapAlgPolicy`. The policy tag is always
+// set to "classic".
+template <class _CompT>
+struct _UnwrapAlgPolicy {
+ using _AlgPolicy = _ClassicAlgPolicy;
+ using _Comp = _CompT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static
+ _Comp __get_comp(_Comp __comp) { return __comp; }
+};
+
+// Unwraps a `_WrapAlgPolicy` struct.
+template <class... _Ts>
+struct _UnwrapAlgPolicy<_WrapAlgPolicy<_Ts...> > {
+ using _Wrapped = _WrapAlgPolicy<_Ts...>;
+ using _AlgPolicy = typename _Wrapped::_AlgPolicy;
+ using _Comp = typename _Wrapped::_Comp;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static
+ _Comp __get_comp(_Wrapped& __w) { return __w.__comp; }
+};
+
// stable, 2-3 compares, 0-2 swaps
-template <class _Compare, class _ForwardIterator>
+template <class _AlgPolicy, class _Compare, class _ForwardIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z,
_Compare __c) {
+ using _Ops = _IterOps<_AlgPolicy>;
+
unsigned __r = 0;
if (!__c(*__y, *__x)) // if x <= y
{
if (!__c(*__z, *__y)) // if y <= z
return __r; // x <= y && y <= z
// x <= y && y > z
- swap(*__y, *__z); // x <= z && y < z
+ _Ops::iter_swap(__y, __z); // x <= z && y < z
__r = 1;
if (__c(*__y, *__x)) // if x > y
{
- swap(*__x, *__y); // x < y && y <= z
+ _Ops::iter_swap(__x, __y); // x < y && y <= z
__r = 2;
}
return __r; // x <= y && y < z
}
if (__c(*__z, *__y)) // x > y, if y > z
{
- swap(*__x, *__z); // x < y && y < z
+ _Ops::iter_swap(__x, __z); // x < y && y < z
__r = 1;
return __r;
}
- swap(*__x, *__y); // x > y && y <= z
+ _Ops::iter_swap(__x, __y); // x > y && y <= z
__r = 1; // x < y && x <= z
if (__c(*__z, *__y)) // if y > z
{
- swap(*__y, *__z); // x <= y && y < z
+ _Ops::iter_swap(__y, __z); // x <= y && y < z
__r = 2;
}
return __r;
@@ -69,18 +117,20 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __sort3(_ForwardIterator __x, _ForwardIte
// stable, 3-6 compares, 0-5 swaps
-template <class _Compare, class _ForwardIterator>
+template <class _AlgPolicy, class _Compare, class _ForwardIterator>
unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4,
_Compare __c) {
- unsigned __r = _VSTD::__sort3<_Compare>(__x1, __x2, __x3, __c);
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ unsigned __r = std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
if (__c(*__x4, *__x3)) {
- swap(*__x3, *__x4);
+ _Ops::iter_swap(__x3, __x4);
++__r;
if (__c(*__x3, *__x2)) {
- swap(*__x2, *__x3);
+ _Ops::iter_swap(__x2, __x3);
++__r;
if (__c(*__x2, *__x1)) {
- swap(*__x1, *__x2);
+ _Ops::iter_swap(__x1, __x2);
++__r;
}
}
@@ -90,21 +140,28 @@ unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator
// stable, 4-10 compares, 0-9 swaps
-template <class _Compare, class _ForwardIterator>
+template <class _WrappedComp, class _ForwardIterator>
_LIBCPP_HIDDEN unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
- _ForwardIterator __x4, _ForwardIterator __x5, _Compare __c) {
- unsigned __r = _VSTD::__sort4<_Compare>(__x1, __x2, __x3, __x4, __c);
+ _ForwardIterator __x4, _ForwardIterator __x5, _WrappedComp __wrapped_comp) {
+ using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
+ using _AlgPolicy = typename _Unwrap::_AlgPolicy;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ using _Compare = typename _Unwrap::_Comp;
+ _Compare __c = _Unwrap::__get_comp(__wrapped_comp);
+
+ unsigned __r = std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c);
if (__c(*__x5, *__x4)) {
- swap(*__x4, *__x5);
+ _Ops::iter_swap(__x4, __x5);
++__r;
if (__c(*__x4, *__x3)) {
- swap(*__x3, *__x4);
+ _Ops::iter_swap(__x3, __x4);
++__r;
if (__c(*__x3, *__x2)) {
- swap(*__x2, *__x3);
+ _Ops::iter_swap(__x2, __x3);
++__r;
if (__c(*__x2, *__x1)) {
- swap(*__x1, *__x2);
+ _Ops::iter_swap(__x1, __x2);
++__r;
}
}
@@ -113,6 +170,16 @@ _LIBCPP_HIDDEN unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _F
return __r;
}
+template <class _AlgPolicy, class _Compare, class _ForwardIterator>
+_LIBCPP_HIDDEN unsigned __sort5_wrap_policy(
+ _ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _ForwardIterator __x5,
+ _Compare __c) {
+ using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Compare>::type;
+ _WrappedComp __wrapped_comp(__c);
+ return std::__sort5<_WrappedComp>(
+ std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __wrapped_comp);
+}
+
// The comparator being simple is a prerequisite for using the branchless optimization.
template <class _Tp>
struct __is_simple_comparator : false_type {};
@@ -137,6 +204,7 @@ using __use_branchless_sort =
// Ensures that __c(*__x, *__y) is true by swapping *__x and *__y if necessary.
template <class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI void __cond_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _Compare __c) {
+ // Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
bool __r = __c(*__x, *__y);
value_type __tmp = __r ? *__x : *__y;
@@ -149,6 +217,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __cond_swap(_RandomAccessIterator __x, _Random
template <class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI void __partially_sorted_swap(_RandomAccessIterator __x, _RandomAccessIterator __y,
_RandomAccessIterator __z, _Compare __c) {
+ // Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
bool __r = __c(*__z, *__x);
value_type __tmp = __r ? *__z : *__x;
@@ -158,7 +227,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __partially_sorted_swap(_RandomAccessIterator
*__y = __r ? *__y : __tmp;
}
-template <class _Compare, class _RandomAccessIterator>
+template <class, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void>
__sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
_Compare __c) {
@@ -166,14 +235,14 @@ __sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2,
_VSTD::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void>
__sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
_Compare __c) {
- _VSTD::__sort3<_Compare>(__x1, __x2, __x3, __c);
+ std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void>
__sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
_RandomAccessIterator __x4, _Compare __c) {
@@ -184,14 +253,14 @@ __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2,
_VSTD::__cond_swap<_Compare>(__x2, __x3, __c);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void>
__sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
_RandomAccessIterator __x4, _Compare __c) {
- _VSTD::__sort4<_Compare>(__x1, __x2, __x3, __x4, __c);
+ std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void>
__sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
_RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) {
@@ -203,53 +272,57 @@ __sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2,
_VSTD::__partially_sorted_swap<_Compare>(__x2, __x3, __x4, __c);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void>
__sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
_RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) {
- _VSTD::__sort5<_Compare>(__x1, __x2, __x3, __x4, __x5, __c);
+ std::__sort5_wrap_policy<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __x5, __c);
}
// Assumes size > 0
-template <class _Compare, class _BidirectionalIterator>
+template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
_LIBCPP_CONSTEXPR_AFTER_CXX11 void __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last,
_Compare __comp) {
_BidirectionalIterator __lm1 = __last;
for (--__lm1; __first != __lm1; ++__first) {
- _BidirectionalIterator __i = _VSTD::min_element(__first, __last, __comp);
+ _BidirectionalIterator __i = std::__min_element<_Compare>(__first, __last, __comp);
if (__i != __first)
- swap(*__first, *__i);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
}
}
-template <class _Compare, class _BidirectionalIterator>
+template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
if (__first != __last) {
_BidirectionalIterator __i = __first;
for (++__i; __i != __last; ++__i) {
_BidirectionalIterator __j = __i;
- value_type __t(_VSTD::move(*__j));
+ value_type __t(_Ops::__iter_move(__j));
for (_BidirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j)
- *__j = _VSTD::move(*__k);
+ *__j = _Ops::__iter_move(__k);
*__j = _VSTD::move(__t);
}
}
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
_RandomAccessIterator __j = __first + difference_type(2);
- _VSTD::__sort3_maybe_branchless<_Compare>(__first, __first + difference_type(1), __j, __comp);
+ std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), __j, __comp);
for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) {
if (__comp(*__i, *__j)) {
- value_type __t(_VSTD::move(*__i));
+ value_type __t(_Ops::__iter_move(__i));
_RandomAccessIterator __k = __j;
__j = __i;
do {
- *__j = _VSTD::move(*__k);
+ *__j = _Ops::__iter_move(__k);
__j = __k;
} while (__j != __first && __comp(__t, *--__k));
*__j = _VSTD::move(__t);
@@ -258,8 +331,16 @@ void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __l
}
}
-template <class _Compare, class _RandomAccessIterator>
-bool __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+template <class _WrappedComp, class _RandomAccessIterator>
+bool __insertion_sort_incomplete(
+ _RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
+ using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
+ using _AlgPolicy = typename _Unwrap::_AlgPolicy;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ using _Compare = typename _Unwrap::_Comp;
+ _Compare __comp = _Unwrap::__get_comp(__wrapped_comp);
+
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
switch (__last - __first) {
case 0:
@@ -267,32 +348,33 @@ bool __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIte
return true;
case 2:
if (__comp(*--__last, *__first))
- swap(*__first, *__last);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
return true;
case 3:
- _VSTD::__sort3_maybe_branchless<_Compare>(__first, __first + difference_type(1), --__last, __comp);
+ std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), --__last, __comp);
return true;
case 4:
- _VSTD::__sort4_maybe_branchless<_Compare>(__first, __first + difference_type(1), __first + difference_type(2),
- --__last, __comp);
+ std::__sort4_maybe_branchless<_AlgPolicy, _Compare>(
+ __first, __first + difference_type(1), __first + difference_type(2), --__last, __comp);
return true;
case 5:
- _VSTD::__sort5_maybe_branchless<_Compare>(__first, __first + difference_type(1), __first + difference_type(2),
- __first + difference_type(3), --__last, __comp);
+ std::__sort5_maybe_branchless<_AlgPolicy, _Compare>(
+ __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3),
+ --__last, __comp);
return true;
}
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
_RandomAccessIterator __j = __first + difference_type(2);
- _VSTD::__sort3_maybe_branchless<_Compare>(__first, __first + difference_type(1), __j, __comp);
+ std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), __j, __comp);
const unsigned __limit = 8;
unsigned __count = 0;
for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) {
if (__comp(*__i, *__j)) {
- value_type __t(_VSTD::move(*__i));
+ value_type __t(_Ops::__iter_move(__i));
_RandomAccessIterator __k = __j;
__j = __i;
do {
- *__j = _VSTD::move(*__k);
+ *__j = _Ops::__iter_move(__k);
__j = __k;
} while (__j != __first && __comp(__t, *--__k));
*__j = _VSTD::move(__t);
@@ -304,27 +386,29 @@ bool __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIte
return true;
}
-template <class _Compare, class _BidirectionalIterator>
+template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1,
typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
if (__first1 != __last1) {
__destruct_n __d(0);
unique_ptr<value_type, __destruct_n&> __h(__first2, __d);
value_type* __last2 = __first2;
- ::new ((void*)__last2) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__last2) value_type(_Ops::__iter_move(__first1));
__d.template __incr<value_type>();
for (++__last2; ++__first1 != __last1; ++__last2) {
value_type* __j2 = __last2;
value_type* __i2 = __j2;
if (__comp(*__first1, *--__i2)) {
- ::new ((void*)__j2) value_type(_VSTD::move(*__i2));
+ ::new ((void*)__j2) value_type(std::move(*__i2));
__d.template __incr<value_type>();
for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2)
- *__j2 = _VSTD::move(*__i2);
- *__j2 = _VSTD::move(*__first1);
+ *__j2 = std::move(*__i2);
+ *__j2 = _Ops::__iter_move(__first1);
} else {
- ::new ((void*)__j2) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__j2) value_type(_Ops::__iter_move(__first1));
__d.template __incr<value_type>();
}
}
@@ -332,9 +416,11 @@ void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterat
}
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __depth) {
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
const difference_type __limit =
@@ -348,28 +434,29 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
return;
case 2:
if (__comp(*--__last, *__first))
- swap(*__first, *__last);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
return;
case 3:
- _VSTD::__sort3_maybe_branchless<_Compare>(__first, __first + difference_type(1), --__last, __comp);
+ std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), --__last, __comp);
return;
case 4:
- _VSTD::__sort4_maybe_branchless<_Compare>(__first, __first + difference_type(1), __first + difference_type(2),
- --__last, __comp);
+ std::__sort4_maybe_branchless<_AlgPolicy, _Compare>(
+ __first, __first + difference_type(1), __first + difference_type(2), --__last, __comp);
return;
case 5:
- _VSTD::__sort5_maybe_branchless<_Compare>(__first, __first + difference_type(1), __first + difference_type(2),
- __first + difference_type(3), --__last, __comp);
+ std::__sort5_maybe_branchless<_AlgPolicy, _Compare>(
+ __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3),
+ --__last, __comp);
return;
}
if (__len <= __limit) {
- _VSTD::__insertion_sort_3<_Compare>(__first, __last, __comp);
+ std::__insertion_sort_3<_AlgPolicy, _Compare>(__first, __last, __comp);
return;
}
// __len > 5
if (__depth == 0) {
// Fallback to heap sort as Introsort suggests.
- _VSTD::__partial_sort<_Compare>(__first, __last, __last, __comp);
+ std::__partial_sort<_AlgPolicy, _Compare>(__first, __last, __last, __comp);
return;
}
--__depth;
@@ -383,11 +470,12 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
__delta = __len / 2;
__m += __delta;
__delta /= 2;
- __n_swaps = _VSTD::__sort5<_Compare>(__first, __first + __delta, __m, __m + __delta, __lm1, __comp);
+ __n_swaps = std::__sort5_wrap_policy<_AlgPolicy, _Compare>(
+ __first, __first + __delta, __m, __m + __delta, __lm1, __comp);
} else {
__delta = __len / 2;
__m += __delta;
- __n_swaps = _VSTD::__sort3<_Compare>(__first, __m, __lm1, __comp);
+ __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, __lm1, __comp);
}
}
// *__m is median
@@ -414,7 +502,7 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
if (__i == __j)
return; // [__first, __last) all equivalent elements
if (__comp(*__first, *__i)) {
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
++__i;
break;
@@ -432,7 +520,7 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
;
if (__i >= __j)
break;
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
++__i;
}
@@ -443,7 +531,7 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
goto __restart;
}
if (__comp(*__j, *__m)) {
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
break; // found guard for downward moving __j, now use unguarded partition
}
@@ -465,7 +553,7 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
;
if (__i > __j)
break;
- swap(*__i, *__j);
+ _Ops::iter_swap(__i, __j);
++__n_swaps;
// It is known that __m != __j
// If __m just moved, follow it
@@ -476,14 +564,16 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
}
// [__first, __i) < *__m and *__m <= [__i, __last)
if (__i != __m && __comp(*__m, *__i)) {
- swap(*__i, *__m);
+ _Ops::iter_swap(__i, __m);
++__n_swaps;
}
// [__first, __i) < *__i and *__i <= [__i+1, __last)
// If we were given a perfect partition, see if insertion sort is quick...
if (__n_swaps == 0) {
- bool __fs = _VSTD::__insertion_sort_incomplete<_Compare>(__first, __i, __comp);
- if (_VSTD::__insertion_sort_incomplete<_Compare>(__i + difference_type(1), __last, __comp)) {
+ using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Compare>::type;
+ _WrappedComp __wrapped_comp(__comp);
+ bool __fs = std::__insertion_sort_incomplete<_WrappedComp>(__first, __i, __wrapped_comp);
+ if (std::__insertion_sort_incomplete<_WrappedComp>(__i + difference_type(1), __last, __wrapped_comp)) {
if (__fs)
return;
__last = __i;
@@ -497,10 +587,10 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
}
// sort smaller range with recursive call and larger with tail recursion elimination
if (__i - __first < __last - __i) {
- _VSTD::__introsort<_Compare>(__first, __i, __comp, __depth);
+ std::__introsort<_AlgPolicy, _Compare>(__first, __i, __comp, __depth);
__first = ++__i;
} else {
- _VSTD::__introsort<_Compare>(__i + difference_type(1), __last, __comp, __depth);
+ std::__introsort<_AlgPolicy, _Compare>(__i + difference_type(1), __last, __comp, __depth);
__last = __i;
}
}
@@ -525,17 +615,22 @@ inline _LIBCPP_HIDE_FROM_ABI _Number __log2i(_Number __n) {
return __log2;
}
-template <class _Compare, class _RandomAccessIterator>
-void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+template <class _WrappedComp, class _RandomAccessIterator>
+void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
difference_type __depth_limit = 2 * __log2i(__last - __first);
- _VSTD::__introsort<_Compare>(__first, __last, __comp, __depth_limit);
+
+ using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
+ using _AlgPolicy = typename _Unwrap::_AlgPolicy;
+ using _Compare = typename _Unwrap::_Comp;
+ _Compare __comp = _Unwrap::__get_comp(__wrapped_comp);
+ std::__introsort<_AlgPolicy, _Compare>(__first, __last, __comp, __depth_limit);
}
template <class _Compare, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY void __sort(_Tp** __first, _Tp** __last, __less<_Tp*>&) {
__less<uintptr_t> __comp;
- _VSTD::__sort<__less<uintptr_t>&, uintptr_t*>((uintptr_t*)__first, (uintptr_t*)__last, __comp);
+ std::__sort<__less<uintptr_t>&, uintptr_t*>((uintptr_t*)__first, (uintptr_t*)__last, __comp);
}
extern template _LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
@@ -576,22 +671,27 @@ extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long do
extern template _LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
-template <class _RandomAccessIterator, class _Comp>
+template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
- std::__debug_randomize_range(__first, __last);
+ std::__debug_randomize_range<_AlgPolicy>(__first, __last);
+
using _Comp_ref = typename __comp_ref_type<_Comp>::type;
if (__libcpp_is_constant_evaluated()) {
- std::__partial_sort<_Comp_ref>(__first, __last, __last, _Comp_ref(__comp));
+ std::__partial_sort<_AlgPolicy>(__first, __last, __last, __comp);
+
} else {
- std::__sort<_Comp_ref>(std::__unwrap_iter(__first), std::__unwrap_iter(__last), _Comp_ref(__comp));
+ using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Comp_ref>::type;
+ _Comp_ref __comp_ref(__comp);
+ _WrappedComp __wrapped_comp(__comp_ref);
+ std::__sort<_WrappedComp>(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __wrapped_comp);
}
}
template <class _RandomAccessIterator, class _Comp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
- std::__sort_impl(std::move(__first), std::move(__last), __comp);
+ std::__sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h
index 261adedd0e..b9f0b2c969 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort_heap.h
@@ -11,11 +11,12 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/pop_heap.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>
-#include <type_traits> // swap
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -23,7 +24,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
using _CompRef = typename __comp_ref_type<_Compare>::type;
@@ -31,13 +32,16 @@ void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n)
- std::__pop_heap<_CompRef>(__first, __last, __comp_ref, __n);
+ std::__pop_heap<_AlgPolicy, _CompRef>(__first, __last, __comp_ref, __n);
}
template <class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
- std::__sort_heap(std::move(__first), std::move(__last), __comp);
+ static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
+ static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
+
+ std::__sort_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h
index 969ac7a617..e5ad48b2ed 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h
@@ -9,13 +9,14 @@
#ifndef _LIBCPP___ALGORITHM_STABLE_PARTITION_H
#define _LIBCPP___ALGORITHM_STABLE_PARTITION_H
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/rotate.h>
#include <__config>
#include <__iterator/advance.h>
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
-#include <__utility/swap.h>
#include <memory>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -23,11 +24,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
+template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
_ForwardIterator
-__stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
+__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
_Distance __len, _Pair __p, forward_iterator_tag __fit)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
// *__first is known to be false
// __len >= 1
if (__len == 1)
@@ -37,7 +40,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
_ForwardIterator __m = __first;
if (__pred(*++__m))
{
- swap(*__first, *__m);
+ _Ops::iter_swap(__first, __m);
return __m;
}
return __first;
@@ -50,7 +53,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
// Move the falses into the temporary buffer, and the trues to the front of the line
// Update __first to always point to the end of the trues
value_type* __t = __p.first;
- ::new ((void*)__t) value_type(_VSTD::move(*__first));
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
__d.template __incr<value_type>();
++__t;
_ForwardIterator __i = __first;
@@ -58,12 +61,12 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
{
if (__pred(*__i))
{
- *__first = _VSTD::move(*__i);
+ *__first = _Ops::__iter_move(__i);
++__first;
}
else
{
- ::new ((void*)__t) value_type(_VSTD::move(*__i));
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
__d.template __incr<value_type>();
++__t;
}
@@ -72,7 +75,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
// Move falses back into range, but don't mess up __first which points to first false
__i = __first;
for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
- *__i = _VSTD::move(*__t2);
+ *__i = _Ops::__iter_move(__t2);
// __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
return __first;
}
@@ -80,11 +83,12 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
// __len >= 3
_ForwardIterator __m = __first;
_Distance __len2 = __len / 2; // __len2 >= 2
- _VSTD::advance(__m, __len2);
+ _Ops::advance(__m, __len2);
// recurse on [__first, __m), *__first know to be false
// F?????????????????
// f m l
- _ForwardIterator __first_false = _VSTD::__stable_partition<_Predicate&>(__first, __m, __pred, __len2, __p, __fit);
+ _ForwardIterator __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ __first, __m, __pred, __len2, __p, __fit);
// TTTFFFFF??????????
// f ff m l
// recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
@@ -99,18 +103,19 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
}
// TTTFFFFFTTTF??????
// f ff m m1 l
- __second_false = _VSTD::__stable_partition<_Predicate&>(__m1, __last, __pred, __len_half, __p, __fit);
+ __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ __m1, __last, __pred, __len_half, __p, __fit);
__second_half_done:
// TTTFFFFFTTTTTFFFFF
// f ff m sf l
- return _VSTD::rotate(__first_false, __m, __second_false);
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false, __fit);
// TTTTTTTTFFFFFFFFFF
// |
}
-template <class _Predicate, class _ForwardIterator>
+template <class _AlgPolicy, class _Predicate, class _ForwardIterator>
_ForwardIterator
-__stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
+__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
forward_iterator_tag)
{
const unsigned __alloc_limit = 3; // might want to make this a function of trivial assignment
@@ -127,7 +132,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
// *__first is known to be false
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- difference_type __len = _VSTD::distance(__first, __last);
+ difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last);
pair<value_type*, ptrdiff_t> __p(0, 0);
unique_ptr<value_type, __return_temporary_buffer> __h;
if (__len >= __alloc_limit)
@@ -138,20 +143,23 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
_LIBCPP_SUPPRESS_DEPRECATED_POP
__h.reset(__p.first);
}
- return _VSTD::__stable_partition<_Predicate&>(__first, __last, __pred, __len, __p, forward_iterator_tag());
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag());
}
-template <class _Predicate, class _BidirectionalIterator, class _Distance, class _Pair>
+template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator, class _Distance, class _Pair>
_BidirectionalIterator
-__stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
+__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
_Distance __len, _Pair __p, bidirectional_iterator_tag __bit)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
// *__first is known to be false
// *__last is known to be true
// __len >= 2
if (__len == 2)
{
- swap(*__first, *__last);
+ _Ops::iter_swap(__first, __last);
return __last;
}
if (__len == 3)
@@ -159,12 +167,12 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
_BidirectionalIterator __m = __first;
if (__pred(*++__m))
{
- swap(*__first, *__m);
- swap(*__m, *__last);
+ _Ops::iter_swap(__first, __m);
+ _Ops::iter_swap(__m, __last);
return __last;
}
- swap(*__m, *__last);
- swap(*__first, *__m);
+ _Ops::iter_swap(__m, __last);
+ _Ops::iter_swap(__first, __m);
return __m;
}
if (__len <= __p.second)
@@ -175,7 +183,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
// Move the falses into the temporary buffer, and the trues to the front of the line
// Update __first to always point to the end of the trues
value_type* __t = __p.first;
- ::new ((void*)__t) value_type(_VSTD::move(*__first));
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
__d.template __incr<value_type>();
++__t;
_BidirectionalIterator __i = __first;
@@ -183,23 +191,23 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
{
if (__pred(*__i))
{
- *__first = _VSTD::move(*__i);
+ *__first = _Ops::__iter_move(__i);
++__first;
}
else
{
- ::new ((void*)__t) value_type(_VSTD::move(*__i));
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
__d.template __incr<value_type>();
++__t;
}
}
// move *__last, known to be true
- *__first = _VSTD::move(*__i);
+ *__first = _Ops::__iter_move(__i);
__i = ++__first;
// All trues now at start of range, all falses in buffer
// Move falses back into range, but don't mess up __first which points to first false
for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
- *__i = _VSTD::move(*__t2);
+ *__i = _Ops::__iter_move(__t2);
// __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
return __first;
}
@@ -207,7 +215,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
// __len >= 4
_BidirectionalIterator __m = __first;
_Distance __len2 = __len / 2; // __len2 >= 2
- _VSTD::advance(__m, __len2);
+ _Ops::advance(__m, __len2);
// recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false
// F????????????????T
// f m l
@@ -222,7 +230,8 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
}
// F???TFFF?????????T
// f m1 m l
- __first_false = _VSTD::__stable_partition<_Predicate&>(__first, __m1, __pred, __len_half, __p, __bit);
+ __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ __first, __m1, __pred, __len_half, __p, __bit);
__first_half_done:
// TTTFFFFF?????????T
// f ff m l
@@ -239,18 +248,19 @@ __first_half_done:
}
// TTTFFFFFTTTF?????T
// f ff m m1 l
- __second_false = _VSTD::__stable_partition<_Predicate&>(__m1, __last, __pred, __len_half, __p, __bit);
+ __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ __m1, __last, __pred, __len_half, __p, __bit);
__second_half_done:
// TTTFFFFFTTTTTFFFFF
// f ff m sf l
- return _VSTD::rotate(__first_false, __m, __second_false);
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false, __bit);
// TTTTTTTTFFFFFFFFFF
// |
}
-template <class _Predicate, class _BidirectionalIterator>
+template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator>
_BidirectionalIterator
-__stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
+__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
bidirectional_iterator_tag)
{
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
@@ -276,7 +286,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
// *__first is known to be false
// *__last is known to be true
// __len >= 2
- difference_type __len = _VSTD::distance(__first, __last) + 1;
+ difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1;
pair<value_type*, ptrdiff_t> __p(0, 0);
unique_ptr<value_type, __return_temporary_buffer> __h;
if (__len >= __alloc_limit)
@@ -287,7 +297,16 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
_LIBCPP_SUPPRESS_DEPRECATED_POP
__h.reset(__p.first);
}
- return _VSTD::__stable_partition<_Predicate&>(__first, __last, __pred, __len, __p, bidirectional_iterator_tag());
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag());
+}
+
+template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _IterCategory>
+_LIBCPP_HIDE_FROM_ABI
+_ForwardIterator __stable_partition(
+ _ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) {
+ return std::__stable_partition_impl<_AlgPolicy, __uncvref_t<_Predicate>&>(
+ std::move(__first), std::move(__last), __pred, __iter_category);
}
template <class _ForwardIterator, class _Predicate>
@@ -295,7 +314,9 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
{
- return _VSTD::__stable_partition<_Predicate&>(__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
+ using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
+ return std::__stable_partition<_ClassicAlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, _IterCategory());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h
index e3479aad62..6122758bde 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h
@@ -12,11 +12,11 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/inplace_merge.h>
+#include <__algorithm/iterator_operations.h>
#include <__algorithm/sort.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>
-#include <__utility/swap.h>
#include <memory>
#include <type_traits>
@@ -26,12 +26,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Compare, class _InputIterator1, class _InputIterator2>
+template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2>
void
__merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_InputIterator1>::value_type value_type;
__destruct_n __d(0);
unique_ptr<value_type, __destruct_n&> __h(__result, __d);
@@ -40,111 +42,115 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
if (__first1 == __last1)
{
for (; __first2 != __last2; ++__first2, (void) ++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_VSTD::move(*__first2));
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
__h.release();
return;
}
if (__first2 == __last2)
{
for (; __first1 != __last1; ++__first1, (void) ++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
__h.release();
return;
}
if (__comp(*__first2, *__first1))
{
- ::new ((void*)__result) value_type(_VSTD::move(*__first2));
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
__d.template __incr<value_type>();
++__first2;
}
else
{
- ::new ((void*)__result) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
__d.template __incr<value_type>();
++__first1;
}
}
}
-template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
+template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
void
__merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result, _Compare __comp)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
for (; __first1 != __last1; ++__result)
{
if (__first2 == __last2)
{
for (; __first1 != __last1; ++__first1, (void) ++__result)
- *__result = _VSTD::move(*__first1);
+ *__result = _Ops::__iter_move(__first1);
return;
}
if (__comp(*__first2, *__first1))
{
- *__result = _VSTD::move(*__first2);
+ *__result = _Ops::__iter_move(__first2);
++__first2;
}
else
{
- *__result = _VSTD::move(*__first1);
+ *__result = _Ops::__iter_move(__first1);
++__first1;
}
}
for (; __first2 != __last2; ++__first2, (void) ++__result)
- *__result = _VSTD::move(*__first2);
+ *__result = _Ops::__iter_move(__first2);
}
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
void
__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len,
typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size);
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
void
__stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len,
typename iterator_traits<_RandomAccessIterator>::value_type* __first2)
{
+ using _Ops = _IterOps<_AlgPolicy>;
+
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
switch (__len)
{
case 0:
return;
case 1:
- ::new ((void*)__first2) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
return;
case 2:
__destruct_n __d(0);
unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
if (__comp(*--__last1, *__first1))
{
- ::new ((void*)__first2) value_type(_VSTD::move(*__last1));
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
__d.template __incr<value_type>();
++__first2;
- ::new ((void*)__first2) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
}
else
{
- ::new ((void*)__first2) value_type(_VSTD::move(*__first1));
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
__d.template __incr<value_type>();
++__first2;
- ::new ((void*)__first2) value_type(_VSTD::move(*__last1));
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
}
__h2.release();
return;
}
if (__len <= 8)
{
- _VSTD::__insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp);
+ std::__insertion_sort_move<_AlgPolicy, _Compare>(__first1, __last1, __first2, __comp);
return;
}
typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
_RandomAccessIterator __m = __first1 + __l2;
- _VSTD::__stable_sort<_Compare>(__first1, __m, __comp, __l2, __first2, __l2);
- _VSTD::__stable_sort<_Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
- _VSTD::__merge_move_construct<_Compare>(__first1, __m, __m, __last1, __first2, __comp);
+ std::__stable_sort<_AlgPolicy, _Compare>(__first1, __m, __comp, __l2, __first2, __l2);
+ std::__stable_sort<_AlgPolicy, _Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
+ std::__merge_move_construct<_AlgPolicy, _Compare>(__first1, __m, __m, __last1, __first2, __comp);
}
template <class _Tp>
@@ -153,7 +159,7 @@ struct __stable_sort_switch
static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
};
-template <class _Compare, class _RandomAccessIterator>
+template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
void
__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len,
@@ -168,12 +174,12 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
return;
case 2:
if (__comp(*--__last, *__first))
- swap(*__first, *__last);
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
return;
}
if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value))
{
- _VSTD::__insertion_sort<_Compare>(__first, __last, __comp);
+ std::__insertion_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
return;
}
typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
@@ -182,11 +188,12 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
{
__destruct_n __d(0);
unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
- _VSTD::__stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff);
+ std::__stable_sort_move<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff);
__d.__set(__l2, (value_type*)nullptr);
- _VSTD::__stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
+ std::__stable_sort_move<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
__d.__set(__len, (value_type*)nullptr);
- _VSTD::__merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
+ std::__merge_move_assign<_AlgPolicy, _Compare>(
+ __buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
// _VSTD::__merge<_Compare>(move_iterator<value_type*>(__buff),
// move_iterator<value_type*>(__buff + __l2),
// move_iterator<_RandomAccessIterator>(__buff + __l2),
@@ -194,12 +201,12 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
// __first, __comp);
return;
}
- _VSTD::__stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
- _VSTD::__stable_sort<_Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
- _VSTD::__inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
+ std::__stable_sort<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
+ std::__stable_sort<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
+ std::__inplace_merge<_AlgPolicy, _Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
}
-template <class _RandomAccessIterator, class _Compare>
+template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI
void __stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
@@ -217,13 +224,13 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
- std::__stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
+ std::__stable_sort<_AlgPolicy, _Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
}
template <class _RandomAccessIterator, class _Compare>
inline _LIBCPP_HIDE_FROM_ABI
void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
- std::__stable_sort_impl(std::move(__first), std::move(__last), __comp);
+ std::__stable_sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h
index 7d1807b7bb..fa9a8fbf2d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h
@@ -12,6 +12,7 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__memory/pointer_traits.h>
+#include <__utility/move.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -20,77 +21,50 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-// The job of __unwrap_iter is to lower contiguous iterators (such as
-// vector<T>::iterator) into pointers, to reduce the number of template
-// instantiations and to enable pointer-based optimizations e.g. in std::copy.
-// For iterators that are not contiguous, it must be a no-op.
+// TODO: Change the name of __unwrap_iter_impl to something more appropriate
+// The job of __unwrap_iter is to remove iterator wrappers (like reverse_iterator or __wrap_iter),
+// to reduce the number of template instantiations and to enable pointer-based optimizations e.g. in std::copy.
// In debug mode, we don't do this.
//
-// __unwrap_iter is non-constexpr for user-defined iterators whose
-// `to_address` and/or `operator->` is non-constexpr. This is okay; but we
-// try to avoid doing __unwrap_iter in constant-evaluated contexts anyway.
-//
// Some algorithms (e.g. std::copy, but not std::sort) need to convert an
-// "unwrapped" result back into a contiguous iterator. Since contiguous iterators
-// are random-access, we can do this portably using iterator arithmetic; this
-// is the job of __rewrap_iter.
+// "unwrapped" result back into the original iterator type. Doing that is the job of __rewrap_iter.
+// Default case - we can't unwrap anything
template <class _Iter, bool = __is_cpp17_contiguous_iterator<_Iter>::value>
struct __unwrap_iter_impl {
- static _LIBCPP_CONSTEXPR _Iter
- __apply(_Iter __i) _NOEXCEPT {
- return __i;
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap(_Iter, _Iter __iter) { return __iter; }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __unwrap(_Iter __i) _NOEXCEPT { return __i; }
};
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
+// It's a contiguous iterator, so we can use a raw pointer instead
template <class _Iter>
struct __unwrap_iter_impl<_Iter, true> {
- static _LIBCPP_CONSTEXPR decltype(_VSTD::__to_address(declval<_Iter>()))
- __apply(_Iter __i) _NOEXCEPT {
- return _VSTD::__to_address(__i);
- }
-};
+ using _ToAddressT = decltype(std::__to_address(std::declval<_Iter>()));
-#endif // !_LIBCPP_ENABLE_DEBUG_MODE
-
-template<class _Iter, class _Impl = __unwrap_iter_impl<_Iter> >
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-decltype(_Impl::__apply(declval<_Iter>()))
-__unwrap_iter(_Iter __i) _NOEXCEPT
-{
- return _Impl::__apply(__i);
-}
-
-template <class _OrigIter, class _UnwrappedIter>
-struct __rewrap_iter_impl {
- static _LIBCPP_CONSTEXPR _OrigIter __apply(_OrigIter __first, _UnwrappedIter __result) {
- // Precondition: __result is reachable from __first
- // Precondition: _OrigIter is a contiguous iterator
- return __first + (__result - std::__unwrap_iter(__first));
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap(_Iter __orig_iter, _ToAddressT __unwrapped_iter) {
+ return __orig_iter + (__unwrapped_iter - std::__to_address(__orig_iter));
}
-};
-template <class _OrigIter>
-struct __rewrap_iter_impl<_OrigIter, _OrigIter> {
- static _LIBCPP_CONSTEXPR _OrigIter __apply(_OrigIter, _OrigIter __result) {
- return __result;
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToAddressT __unwrap(_Iter __i) _NOEXCEPT {
+ return std::__to_address(__i);
}
};
-template<class _OrigIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_OrigIter __rewrap_iter(_OrigIter, _OrigIter __result)
-{
- return __result;
+#endif // !_LIBCPP_ENABLE_DEBUG_MODE
+
+template<class _Iter,
+ class _Impl = __unwrap_iter_impl<_Iter>,
+ __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+decltype(_Impl::__unwrap(std::declval<_Iter>())) __unwrap_iter(_Iter __i) _NOEXCEPT {
+ return _Impl::__unwrap(__i);
}
-template<class _OrigIter, class _UnwrappedIter, class _Impl = __rewrap_iter_impl<_OrigIter, _UnwrappedIter> >
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_OrigIter __rewrap_iter(_OrigIter __first, _UnwrappedIter __result)
-{
- return _Impl::__apply(__first, __result);
+template <class _OrigIter, class _Iter, class _Impl = __unwrap_iter_impl<_OrigIter> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) _NOEXCEPT {
+ return _Impl::__rewrap(std::move(__orig_iter), std::move(__iter));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h
index 7e425558e3..d9fa4ffbc4 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h
@@ -12,6 +12,7 @@
#include <__chrono/duration.h>
#include <__config>
+#include <compare>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -45,25 +46,9 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr
bool operator==(const day& __lhs, const day& __rhs) noexcept
{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator!=(const day& __lhs, const day& __rhs) noexcept
-{ return !(__lhs == __rhs); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator< (const day& __lhs, const day& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) < static_cast<unsigned>(__rhs); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator> (const day& __lhs, const day& __rhs) noexcept
-{ return __rhs < __lhs; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator<=(const day& __lhs, const day& __rhs) noexcept
-{ return !(__rhs < __lhs);}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator>=(const day& __lhs, const day& __rhs) noexcept
-{ return !(__lhs < __rhs); }
+_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const day& __lhs, const day& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr
day operator+ (const day& __lhs, const days& __rhs) noexcept
diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config
index bf358075a7..a43e1b4ff6 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__config
+++ b/contrib/libs/cxxsupp/libcxx/include/__config
@@ -229,6 +229,12 @@
# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
# endif
+# ifdef _LIBCPP_COMPILER_MSVC
+# error If you successfully use libc++ with MSVC please tell the libc++ developers and consider upstreaming your \
+changes. We are not aware of anybody using this configuration and know that at least some code is currently broken. \
+If there are users of this configuration we are happy to provide support.
+# endif
+
// FIXME: ABI detection should be done via compiler builtin macros. This
// is just a placeholder until Clang implements such macros. For now assume
// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
@@ -252,6 +258,13 @@
# define _LIBCPP_ABI_VCRUNTIME
# endif
+// Incomplete features get their own specific disabling flags. This makes it
+// easier to grep for target specific flags once the feature is complete.
+# if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY)
+//# define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
+//# define _LIBCPP_HAS_NO_INCOMPLETE_RANGES
+# endif
+
// Need to detect which libc we're using if we're on Linux.
# if defined(__linux__)
# include <features.h>
@@ -560,11 +573,15 @@ typedef __char32_t char32_t;
# define _LIBCPP_TYPE_VIS _LIBCPP_VISIBILITY("default")
# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")
# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
-# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
# define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBILITY("default")
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+// TODO: Make this a proper customization point or remove the option to override it.
+# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
+# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
+# endif
+
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
// The inline should be removed once PR32114 is resolved
# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
diff --git a/contrib/libs/cxxsupp/libcxx/include/__debug_utils/randomize_range.h b/contrib/libs/cxxsupp/libcxx/include/__debug_utils/randomize_range.h
index fd5b9e5884..9ed22556c4 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__debug_utils/randomize_range.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__debug_utils/randomize_range.h
@@ -22,7 +22,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Iterator>
+template <class _AlgPolicy, class _Iterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void __debug_randomize_range(_Iterator __first, _Iterator __last) {
#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
# ifdef _LIBCPP_CXX03_LANG
@@ -30,7 +30,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 void __debug_randomize_range
# endif
if (!__libcpp_is_constant_evaluated())
- std::shuffle(__first, __last, __libcpp_debug_randomizer());
+ std::__shuffle<_AlgPolicy>(__first, __last, __libcpp_debug_randomizer());
#else
(void)__first;
(void)__last;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h b/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h
new file mode 100644
index 0000000000..00cd0e91cd
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h
@@ -0,0 +1,332 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING, this entire header is generated by
+// utiles/generate_extended_grapheme_cluster_table.py
+// DO NOT MODIFY!
+
+// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+//
+// See Terms of Use <https://www.unicode.org/copyright.html>
+// for definitions of Unicode Inc.'s Data Files and Software.
+//
+// NOTICE TO USER: Carefully read the following legal agreement.
+// BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
+// DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
+// YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
+// TERMS AND CONDITIONS OF THIS AGREEMENT.
+// IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
+// THE DATA FILES OR SOFTWARE.
+//
+// COPYRIGHT AND PERMISSION NOTICE
+//
+// Copyright (c) 1991-2022 Unicode, Inc. All rights reserved.
+// Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of the Unicode data files and any associated documentation
+// (the "Data Files") or Unicode software and any associated documentation
+// (the "Software") to deal in the Data Files or Software
+// without restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, and/or sell copies of
+// the Data Files or Software, and to permit persons to whom the Data Files
+// or Software are furnished to do so, provided that either
+// (a) this copyright and permission notice appear with all copies
+// of the Data Files or Software, or
+// (b) this copyright and permission notice appear in associated
+// Documentation.
+//
+// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+// NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+// DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+//
+// Except as contained in this notice, the name of a copyright holder
+// shall not be used in advertising or otherwise to promote the sale,
+// use or other dealings in these Data Files or Software without prior
+// written authorization of the copyright holder.
+
+#ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
+#define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
+
+#include <__algorithm/upper_bound.h>
+#include <__config>
+#include <__iterator/access.h>
+#include <cstddef>
+#include <cstdint>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17
+
+namespace __extended_grapheme_custer_property_boundary {
+
+enum class __property : uint8_t {
+ // Values generated from the data files.
+ __CR,
+ __Control,
+ __Extend,
+ __Extended_Pictographic,
+ __L,
+ __LF,
+ __LV,
+ __LVT,
+ __Prepend,
+ __Regional_Indicator,
+ __SpacingMark,
+ __T,
+ __V,
+ __ZWJ,
+
+ // The properies below aren't stored in the "database".
+
+ // Text position properties.
+ __sot,
+ __eot,
+
+ // The code unit has none of above properties.
+ __none
+};
+
+/// The entries of the extended grapheme cluster bondary property table.
+///
+/// The data is generated from
+/// - https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt
+/// - https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
+///
+/// The data has 3 values
+/// - bits [0, 3] The property. One of the values generated form the datafiles
+/// of \ref __property
+/// - bits [4, 10] The size of the range.
+/// - bits [11, 31] The lower bound code point of the range. The upper bound of
+/// the range is lower bound + size.
+///
+/// The 7 bits for the size allow a maximum range of 128 elements. Some ranges
+/// in the Unicode tables are larger. They are stored in multiple consecutive
+/// ranges in the data table. An alternative would be to store the sizes in a
+/// separate 16-bit value. The original MSVC STL code had such an approach, but
+/// this approach uses less space for the data and is about 4% faster in the
+/// following benchmark.
+/// libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp
+inline constexpr uint32_t __entries[1480] = {
+ 0x00000091, 0x00005005, 0x00005811, 0x00006800, 0x00007111, 0x0003fa01, 0x00054803, 0x00056801, 0x00057003,
+ 0x001806f2, 0x00241862, 0x002c8ac2, 0x002df802, 0x002e0812, 0x002e2012, 0x002e3802, 0x00300058, 0x003080a2,
+ 0x0030e001, 0x00325942, 0x00338002, 0x0036b062, 0x0036e808, 0x0036f852, 0x00373812, 0x00375032, 0x00387808,
+ 0x00388802, 0x003981a2, 0x003d30a2, 0x003f5882, 0x003fe802, 0x0040b032, 0x0040d882, 0x00412822, 0x00414842,
+ 0x0042c822, 0x00448018, 0x0044c072, 0x00465172, 0x00471008, 0x004719f2, 0x0048180a, 0x0049d002, 0x0049d80a,
+ 0x0049e002, 0x0049f02a, 0x004a0872, 0x004a483a, 0x004a6802, 0x004a701a, 0x004a8862, 0x004b1012, 0x004c0802,
+ 0x004c101a, 0x004de002, 0x004df002, 0x004df81a, 0x004e0832, 0x004e381a, 0x004e581a, 0x004e6802, 0x004eb802,
+ 0x004f1012, 0x004ff002, 0x00500812, 0x0050180a, 0x0051e002, 0x0051f02a, 0x00520812, 0x00523812, 0x00525822,
+ 0x00528802, 0x00538012, 0x0053a802, 0x00540812, 0x0054180a, 0x0055e002, 0x0055f02a, 0x00560842, 0x00563812,
+ 0x0056480a, 0x0056581a, 0x00566802, 0x00571012, 0x0057d052, 0x00580802, 0x0058101a, 0x0059e002, 0x0059f012,
+ 0x005a000a, 0x005a0832, 0x005a381a, 0x005a581a, 0x005a6802, 0x005aa822, 0x005b1012, 0x005c1002, 0x005df002,
+ 0x005df80a, 0x005e0002, 0x005e081a, 0x005e302a, 0x005e502a, 0x005e6802, 0x005eb802, 0x00600002, 0x0060082a,
+ 0x00602002, 0x0061e002, 0x0061f022, 0x0062083a, 0x00623022, 0x00625032, 0x0062a812, 0x00631012, 0x00640802,
+ 0x0064101a, 0x0065e002, 0x0065f00a, 0x0065f802, 0x0066001a, 0x00661002, 0x0066181a, 0x00663002, 0x0066381a,
+ 0x0066501a, 0x00666012, 0x0066a812, 0x00671012, 0x00680012, 0x0068101a, 0x0069d812, 0x0069f002, 0x0069f81a,
+ 0x006a0832, 0x006a302a, 0x006a502a, 0x006a6802, 0x006a7008, 0x006ab802, 0x006b1012, 0x006c0802, 0x006c101a,
+ 0x006e5002, 0x006e7802, 0x006e801a, 0x006e9022, 0x006eb002, 0x006ec06a, 0x006ef802, 0x006f901a, 0x00718802,
+ 0x0071980a, 0x0071a062, 0x00723872, 0x00758802, 0x0075980a, 0x0075a082, 0x00764052, 0x0078c012, 0x0079a802,
+ 0x0079b802, 0x0079c802, 0x0079f01a, 0x007b88d2, 0x007bf80a, 0x007c0042, 0x007c3012, 0x007c68a2, 0x007cca32,
+ 0x007e3002, 0x00816832, 0x0081880a, 0x00819052, 0x0081c812, 0x0081d81a, 0x0081e812, 0x0082b01a, 0x0082c012,
+ 0x0082f022, 0x00838832, 0x00841002, 0x0084200a, 0x00842812, 0x00846802, 0x0084e802, 0x008805f4, 0x008b047c,
+ 0x008d457b, 0x009ae822, 0x00b89022, 0x00b8a80a, 0x00b99012, 0x00b9a00a, 0x00ba9012, 0x00bb9012, 0x00bda012,
+ 0x00bdb00a, 0x00bdb862, 0x00bdf07a, 0x00be3002, 0x00be381a, 0x00be48a2, 0x00bee802, 0x00c05822, 0x00c07001,
+ 0x00c07802, 0x00c42812, 0x00c54802, 0x00c90022, 0x00c9183a, 0x00c93812, 0x00c9482a, 0x00c9801a, 0x00c99002,
+ 0x00c9985a, 0x00c9c822, 0x00d0b812, 0x00d0c81a, 0x00d0d802, 0x00d2a80a, 0x00d2b002, 0x00d2b80a, 0x00d2c062,
+ 0x00d30002, 0x00d31002, 0x00d32872, 0x00d3685a, 0x00d39892, 0x00d3f802, 0x00d581e2, 0x00d80032, 0x00d8200a,
+ 0x00d9a062, 0x00d9d80a, 0x00d9e002, 0x00d9e84a, 0x00da1002, 0x00da181a, 0x00db5882, 0x00dc0012, 0x00dc100a,
+ 0x00dd080a, 0x00dd1032, 0x00dd301a, 0x00dd4012, 0x00dd500a, 0x00dd5822, 0x00df3002, 0x00df380a, 0x00df4012,
+ 0x00df502a, 0x00df6802, 0x00df700a, 0x00df7822, 0x00df901a, 0x00e1207a, 0x00e16072, 0x00e1a01a, 0x00e1b012,
+ 0x00e68022, 0x00e6a0c2, 0x00e7080a, 0x00e71062, 0x00e76802, 0x00e7a002, 0x00e7b80a, 0x00e7c012, 0x00ee03f2,
+ 0x01005801, 0x01006002, 0x0100680d, 0x01007011, 0x01014061, 0x0101e003, 0x01024803, 0x010300f1, 0x01068202,
+ 0x01091003, 0x0109c803, 0x010ca053, 0x010d4813, 0x0118d013, 0x01194003, 0x011c4003, 0x011e7803, 0x011f48a3,
+ 0x011fc023, 0x01261003, 0x012d5013, 0x012db003, 0x012e0003, 0x012fd833, 0x01300053, 0x013038b3, 0x0130a713,
+ 0x01348753, 0x013840a3, 0x0138a003, 0x0138b003, 0x0138e803, 0x01390803, 0x01394003, 0x01399813, 0x013a2003,
+ 0x013a3803, 0x013a6003, 0x013a7003, 0x013a9823, 0x013ab803, 0x013b1843, 0x013ca823, 0x013d0803, 0x013d8003,
+ 0x013df803, 0x0149a013, 0x01582823, 0x0158d813, 0x015a8003, 0x015aa803, 0x01677822, 0x016bf802, 0x016f01f2,
+ 0x01815052, 0x01818003, 0x0181e803, 0x0184c812, 0x0194b803, 0x0194c803, 0x05337832, 0x0533a092, 0x0534f012,
+ 0x05378012, 0x05401002, 0x05403002, 0x05405802, 0x0541181a, 0x05412812, 0x0541380a, 0x05416002, 0x0544001a,
+ 0x0545a0fa, 0x05462012, 0x05470112, 0x0547f802, 0x05493072, 0x054a38a2, 0x054a901a, 0x054b01c4, 0x054c0022,
+ 0x054c180a, 0x054d9802, 0x054da01a, 0x054db032, 0x054dd01a, 0x054de012, 0x054df02a, 0x054f2802, 0x05514852,
+ 0x0551781a, 0x05518812, 0x0551981a, 0x0551a812, 0x05521802, 0x05526002, 0x0552680a, 0x0553e002, 0x05558002,
+ 0x05559022, 0x0555b812, 0x0555f012, 0x05560802, 0x0557580a, 0x05576012, 0x0557701a, 0x0557a80a, 0x0557b002,
+ 0x055f181a, 0x055f2802, 0x055f301a, 0x055f4002, 0x055f481a, 0x055f600a, 0x055f6802, 0x05600006, 0x056009a7,
+ 0x0560e006, 0x0560e9a7, 0x0561c006, 0x0561c9a7, 0x0562a006, 0x0562a9a7, 0x05638006, 0x056389a7, 0x05646006,
+ 0x056469a7, 0x05654006, 0x056549a7, 0x05662006, 0x056629a7, 0x05670006, 0x056709a7, 0x0567e006, 0x0567e9a7,
+ 0x0568c006, 0x0568c9a7, 0x0569a006, 0x0569a9a7, 0x056a8006, 0x056a89a7, 0x056b6006, 0x056b69a7, 0x056c4006,
+ 0x056c49a7, 0x056d2006, 0x056d29a7, 0x056e0006, 0x056e09a7, 0x056ee006, 0x056ee9a7, 0x056fc006, 0x056fc9a7,
+ 0x0570a006, 0x0570a9a7, 0x05718006, 0x057189a7, 0x05726006, 0x057269a7, 0x05734006, 0x057349a7, 0x05742006,
+ 0x057429a7, 0x05750006, 0x057509a7, 0x0575e006, 0x0575e9a7, 0x0576c006, 0x0576c9a7, 0x0577a006, 0x0577a9a7,
+ 0x05788006, 0x057889a7, 0x05796006, 0x057969a7, 0x057a4006, 0x057a49a7, 0x057b2006, 0x057b29a7, 0x057c0006,
+ 0x057c09a7, 0x057ce006, 0x057ce9a7, 0x057dc006, 0x057dc9a7, 0x057ea006, 0x057ea9a7, 0x057f8006, 0x057f89a7,
+ 0x05806006, 0x058069a7, 0x05814006, 0x058149a7, 0x05822006, 0x058229a7, 0x05830006, 0x058309a7, 0x0583e006,
+ 0x0583e9a7, 0x0584c006, 0x0584c9a7, 0x0585a006, 0x0585a9a7, 0x05868006, 0x058689a7, 0x05876006, 0x058769a7,
+ 0x05884006, 0x058849a7, 0x05892006, 0x058929a7, 0x058a0006, 0x058a09a7, 0x058ae006, 0x058ae9a7, 0x058bc006,
+ 0x058bc9a7, 0x058ca006, 0x058ca9a7, 0x058d8006, 0x058d89a7, 0x058e6006, 0x058e69a7, 0x058f4006, 0x058f49a7,
+ 0x05902006, 0x059029a7, 0x05910006, 0x059109a7, 0x0591e006, 0x0591e9a7, 0x0592c006, 0x0592c9a7, 0x0593a006,
+ 0x0593a9a7, 0x05948006, 0x059489a7, 0x05956006, 0x059569a7, 0x05964006, 0x059649a7, 0x05972006, 0x059729a7,
+ 0x05980006, 0x059809a7, 0x0598e006, 0x0598e9a7, 0x0599c006, 0x0599c9a7, 0x059aa006, 0x059aa9a7, 0x059b8006,
+ 0x059b89a7, 0x059c6006, 0x059c69a7, 0x059d4006, 0x059d49a7, 0x059e2006, 0x059e29a7, 0x059f0006, 0x059f09a7,
+ 0x059fe006, 0x059fe9a7, 0x05a0c006, 0x05a0c9a7, 0x05a1a006, 0x05a1a9a7, 0x05a28006, 0x05a289a7, 0x05a36006,
+ 0x05a369a7, 0x05a44006, 0x05a449a7, 0x05a52006, 0x05a529a7, 0x05a60006, 0x05a609a7, 0x05a6e006, 0x05a6e9a7,
+ 0x05a7c006, 0x05a7c9a7, 0x05a8a006, 0x05a8a9a7, 0x05a98006, 0x05a989a7, 0x05aa6006, 0x05aa69a7, 0x05ab4006,
+ 0x05ab49a7, 0x05ac2006, 0x05ac29a7, 0x05ad0006, 0x05ad09a7, 0x05ade006, 0x05ade9a7, 0x05aec006, 0x05aec9a7,
+ 0x05afa006, 0x05afa9a7, 0x05b08006, 0x05b089a7, 0x05b16006, 0x05b169a7, 0x05b24006, 0x05b249a7, 0x05b32006,
+ 0x05b329a7, 0x05b40006, 0x05b409a7, 0x05b4e006, 0x05b4e9a7, 0x05b5c006, 0x05b5c9a7, 0x05b6a006, 0x05b6a9a7,
+ 0x05b78006, 0x05b789a7, 0x05b86006, 0x05b869a7, 0x05b94006, 0x05b949a7, 0x05ba2006, 0x05ba29a7, 0x05bb0006,
+ 0x05bb09a7, 0x05bbe006, 0x05bbe9a7, 0x05bcc006, 0x05bcc9a7, 0x05bda006, 0x05bda9a7, 0x05be8006, 0x05be89a7,
+ 0x05bf6006, 0x05bf69a7, 0x05c04006, 0x05c049a7, 0x05c12006, 0x05c129a7, 0x05c20006, 0x05c209a7, 0x05c2e006,
+ 0x05c2e9a7, 0x05c3c006, 0x05c3c9a7, 0x05c4a006, 0x05c4a9a7, 0x05c58006, 0x05c589a7, 0x05c66006, 0x05c669a7,
+ 0x05c74006, 0x05c749a7, 0x05c82006, 0x05c829a7, 0x05c90006, 0x05c909a7, 0x05c9e006, 0x05c9e9a7, 0x05cac006,
+ 0x05cac9a7, 0x05cba006, 0x05cba9a7, 0x05cc8006, 0x05cc89a7, 0x05cd6006, 0x05cd69a7, 0x05ce4006, 0x05ce49a7,
+ 0x05cf2006, 0x05cf29a7, 0x05d00006, 0x05d009a7, 0x05d0e006, 0x05d0e9a7, 0x05d1c006, 0x05d1c9a7, 0x05d2a006,
+ 0x05d2a9a7, 0x05d38006, 0x05d389a7, 0x05d46006, 0x05d469a7, 0x05d54006, 0x05d549a7, 0x05d62006, 0x05d629a7,
+ 0x05d70006, 0x05d709a7, 0x05d7e006, 0x05d7e9a7, 0x05d8c006, 0x05d8c9a7, 0x05d9a006, 0x05d9a9a7, 0x05da8006,
+ 0x05da89a7, 0x05db6006, 0x05db69a7, 0x05dc4006, 0x05dc49a7, 0x05dd2006, 0x05dd29a7, 0x05de0006, 0x05de09a7,
+ 0x05dee006, 0x05dee9a7, 0x05dfc006, 0x05dfc9a7, 0x05e0a006, 0x05e0a9a7, 0x05e18006, 0x05e189a7, 0x05e26006,
+ 0x05e269a7, 0x05e34006, 0x05e349a7, 0x05e42006, 0x05e429a7, 0x05e50006, 0x05e509a7, 0x05e5e006, 0x05e5e9a7,
+ 0x05e6c006, 0x05e6c9a7, 0x05e7a006, 0x05e7a9a7, 0x05e88006, 0x05e889a7, 0x05e96006, 0x05e969a7, 0x05ea4006,
+ 0x05ea49a7, 0x05eb2006, 0x05eb29a7, 0x05ec0006, 0x05ec09a7, 0x05ece006, 0x05ece9a7, 0x05edc006, 0x05edc9a7,
+ 0x05eea006, 0x05eea9a7, 0x05ef8006, 0x05ef89a7, 0x05f06006, 0x05f069a7, 0x05f14006, 0x05f149a7, 0x05f22006,
+ 0x05f229a7, 0x05f30006, 0x05f309a7, 0x05f3e006, 0x05f3e9a7, 0x05f4c006, 0x05f4c9a7, 0x05f5a006, 0x05f5a9a7,
+ 0x05f68006, 0x05f689a7, 0x05f76006, 0x05f769a7, 0x05f84006, 0x05f849a7, 0x05f92006, 0x05f929a7, 0x05fa0006,
+ 0x05fa09a7, 0x05fae006, 0x05fae9a7, 0x05fbc006, 0x05fbc9a7, 0x05fca006, 0x05fca9a7, 0x05fd8006, 0x05fd89a7,
+ 0x05fe6006, 0x05fe69a7, 0x05ff4006, 0x05ff49a7, 0x06002006, 0x060029a7, 0x06010006, 0x060109a7, 0x0601e006,
+ 0x0601e9a7, 0x0602c006, 0x0602c9a7, 0x0603a006, 0x0603a9a7, 0x06048006, 0x060489a7, 0x06056006, 0x060569a7,
+ 0x06064006, 0x060649a7, 0x06072006, 0x060729a7, 0x06080006, 0x060809a7, 0x0608e006, 0x0608e9a7, 0x0609c006,
+ 0x0609c9a7, 0x060aa006, 0x060aa9a7, 0x060b8006, 0x060b89a7, 0x060c6006, 0x060c69a7, 0x060d4006, 0x060d49a7,
+ 0x060e2006, 0x060e29a7, 0x060f0006, 0x060f09a7, 0x060fe006, 0x060fe9a7, 0x0610c006, 0x0610c9a7, 0x0611a006,
+ 0x0611a9a7, 0x06128006, 0x061289a7, 0x06136006, 0x061369a7, 0x06144006, 0x061449a7, 0x06152006, 0x061529a7,
+ 0x06160006, 0x061609a7, 0x0616e006, 0x0616e9a7, 0x0617c006, 0x0617c9a7, 0x0618a006, 0x0618a9a7, 0x06198006,
+ 0x061989a7, 0x061a6006, 0x061a69a7, 0x061b4006, 0x061b49a7, 0x061c2006, 0x061c29a7, 0x061d0006, 0x061d09a7,
+ 0x061de006, 0x061de9a7, 0x061ec006, 0x061ec9a7, 0x061fa006, 0x061fa9a7, 0x06208006, 0x062089a7, 0x06216006,
+ 0x062169a7, 0x06224006, 0x062249a7, 0x06232006, 0x062329a7, 0x06240006, 0x062409a7, 0x0624e006, 0x0624e9a7,
+ 0x0625c006, 0x0625c9a7, 0x0626a006, 0x0626a9a7, 0x06278006, 0x062789a7, 0x06286006, 0x062869a7, 0x06294006,
+ 0x062949a7, 0x062a2006, 0x062a29a7, 0x062b0006, 0x062b09a7, 0x062be006, 0x062be9a7, 0x062cc006, 0x062cc9a7,
+ 0x062da006, 0x062da9a7, 0x062e8006, 0x062e89a7, 0x062f6006, 0x062f69a7, 0x06304006, 0x063049a7, 0x06312006,
+ 0x063129a7, 0x06320006, 0x063209a7, 0x0632e006, 0x0632e9a7, 0x0633c006, 0x0633c9a7, 0x0634a006, 0x0634a9a7,
+ 0x06358006, 0x063589a7, 0x06366006, 0x063669a7, 0x06374006, 0x063749a7, 0x06382006, 0x063829a7, 0x06390006,
+ 0x063909a7, 0x0639e006, 0x0639e9a7, 0x063ac006, 0x063ac9a7, 0x063ba006, 0x063ba9a7, 0x063c8006, 0x063c89a7,
+ 0x063d6006, 0x063d69a7, 0x063e4006, 0x063e49a7, 0x063f2006, 0x063f29a7, 0x06400006, 0x064009a7, 0x0640e006,
+ 0x0640e9a7, 0x0641c006, 0x0641c9a7, 0x0642a006, 0x0642a9a7, 0x06438006, 0x064389a7, 0x06446006, 0x064469a7,
+ 0x06454006, 0x064549a7, 0x06462006, 0x064629a7, 0x06470006, 0x064709a7, 0x0647e006, 0x0647e9a7, 0x0648c006,
+ 0x0648c9a7, 0x0649a006, 0x0649a9a7, 0x064a8006, 0x064a89a7, 0x064b6006, 0x064b69a7, 0x064c4006, 0x064c49a7,
+ 0x064d2006, 0x064d29a7, 0x064e0006, 0x064e09a7, 0x064ee006, 0x064ee9a7, 0x064fc006, 0x064fc9a7, 0x0650a006,
+ 0x0650a9a7, 0x06518006, 0x065189a7, 0x06526006, 0x065269a7, 0x06534006, 0x065349a7, 0x06542006, 0x065429a7,
+ 0x06550006, 0x065509a7, 0x0655e006, 0x0655e9a7, 0x0656c006, 0x0656c9a7, 0x0657a006, 0x0657a9a7, 0x06588006,
+ 0x065889a7, 0x06596006, 0x065969a7, 0x065a4006, 0x065a49a7, 0x065b2006, 0x065b29a7, 0x065c0006, 0x065c09a7,
+ 0x065ce006, 0x065ce9a7, 0x065dc006, 0x065dc9a7, 0x065ea006, 0x065ea9a7, 0x065f8006, 0x065f89a7, 0x06606006,
+ 0x066069a7, 0x06614006, 0x066149a7, 0x06622006, 0x066229a7, 0x06630006, 0x066309a7, 0x0663e006, 0x0663e9a7,
+ 0x0664c006, 0x0664c9a7, 0x0665a006, 0x0665a9a7, 0x06668006, 0x066689a7, 0x06676006, 0x066769a7, 0x06684006,
+ 0x066849a7, 0x06692006, 0x066929a7, 0x066a0006, 0x066a09a7, 0x066ae006, 0x066ae9a7, 0x066bc006, 0x066bc9a7,
+ 0x066ca006, 0x066ca9a7, 0x066d8006, 0x066d89a7, 0x066e6006, 0x066e69a7, 0x066f4006, 0x066f49a7, 0x06702006,
+ 0x067029a7, 0x06710006, 0x067109a7, 0x0671e006, 0x0671e9a7, 0x0672c006, 0x0672c9a7, 0x0673a006, 0x0673a9a7,
+ 0x06748006, 0x067489a7, 0x06756006, 0x067569a7, 0x06764006, 0x067649a7, 0x06772006, 0x067729a7, 0x06780006,
+ 0x067809a7, 0x0678e006, 0x0678e9a7, 0x0679c006, 0x0679c9a7, 0x067aa006, 0x067aa9a7, 0x067b8006, 0x067b89a7,
+ 0x067c6006, 0x067c69a7, 0x067d4006, 0x067d49a7, 0x067e2006, 0x067e29a7, 0x067f0006, 0x067f09a7, 0x067fe006,
+ 0x067fe9a7, 0x0680c006, 0x0680c9a7, 0x0681a006, 0x0681a9a7, 0x06828006, 0x068289a7, 0x06836006, 0x068369a7,
+ 0x06844006, 0x068449a7, 0x06852006, 0x068529a7, 0x06860006, 0x068609a7, 0x0686e006, 0x0686e9a7, 0x0687c006,
+ 0x0687c9a7, 0x0688a006, 0x0688a9a7, 0x06898006, 0x068989a7, 0x068a6006, 0x068a69a7, 0x068b4006, 0x068b49a7,
+ 0x068c2006, 0x068c29a7, 0x068d0006, 0x068d09a7, 0x068de006, 0x068de9a7, 0x068ec006, 0x068ec9a7, 0x068fa006,
+ 0x068fa9a7, 0x06908006, 0x069089a7, 0x06916006, 0x069169a7, 0x06924006, 0x069249a7, 0x06932006, 0x069329a7,
+ 0x06940006, 0x069409a7, 0x0694e006, 0x0694e9a7, 0x0695c006, 0x0695c9a7, 0x0696a006, 0x0696a9a7, 0x06978006,
+ 0x069789a7, 0x06986006, 0x069869a7, 0x06994006, 0x069949a7, 0x069a2006, 0x069a29a7, 0x069b0006, 0x069b09a7,
+ 0x069be006, 0x069be9a7, 0x069cc006, 0x069cc9a7, 0x069da006, 0x069da9a7, 0x069e8006, 0x069e89a7, 0x069f6006,
+ 0x069f69a7, 0x06a04006, 0x06a049a7, 0x06a12006, 0x06a129a7, 0x06a20006, 0x06a209a7, 0x06a2e006, 0x06a2e9a7,
+ 0x06a3c006, 0x06a3c9a7, 0x06a4a006, 0x06a4a9a7, 0x06a58006, 0x06a589a7, 0x06a66006, 0x06a669a7, 0x06a74006,
+ 0x06a749a7, 0x06a82006, 0x06a829a7, 0x06a90006, 0x06a909a7, 0x06a9e006, 0x06a9e9a7, 0x06aac006, 0x06aac9a7,
+ 0x06aba006, 0x06aba9a7, 0x06ac8006, 0x06ac89a7, 0x06ad6006, 0x06ad69a7, 0x06ae4006, 0x06ae49a7, 0x06af2006,
+ 0x06af29a7, 0x06b00006, 0x06b009a7, 0x06b0e006, 0x06b0e9a7, 0x06b1c006, 0x06b1c9a7, 0x06b2a006, 0x06b2a9a7,
+ 0x06b38006, 0x06b389a7, 0x06b46006, 0x06b469a7, 0x06b54006, 0x06b549a7, 0x06b62006, 0x06b629a7, 0x06b70006,
+ 0x06b709a7, 0x06b7e006, 0x06b7e9a7, 0x06b8c006, 0x06b8c9a7, 0x06b9a006, 0x06b9a9a7, 0x06ba8006, 0x06ba89a7,
+ 0x06bb6006, 0x06bb69a7, 0x06bc4006, 0x06bc49a7, 0x06bd816c, 0x06be5b0b, 0x07d8f002, 0x07f000f2, 0x07f100f2,
+ 0x07f7f801, 0x07fcf012, 0x07ff80b1, 0x080fe802, 0x08170002, 0x081bb042, 0x08500822, 0x08502812, 0x08506032,
+ 0x0851c022, 0x0851f802, 0x08572812, 0x08692032, 0x08755812, 0x087a30a2, 0x087c1032, 0x0880000a, 0x08800802,
+ 0x0880100a, 0x0881c0e2, 0x08838002, 0x08839812, 0x0883f822, 0x0884100a, 0x0885802a, 0x08859832, 0x0885b81a,
+ 0x0885c812, 0x0885e808, 0x08861002, 0x08866808, 0x08880022, 0x08893842, 0x0889600a, 0x08896872, 0x088a281a,
+ 0x088b9802, 0x088c0012, 0x088c100a, 0x088d982a, 0x088db082, 0x088df81a, 0x088e1018, 0x088e4832, 0x088e700a,
+ 0x088e7802, 0x0891602a, 0x08917822, 0x0891901a, 0x0891a002, 0x0891a80a, 0x0891b012, 0x0891f002, 0x0896f802,
+ 0x0897002a, 0x08971872, 0x08980012, 0x0898101a, 0x0899d812, 0x0899f002, 0x0899f80a, 0x089a0002, 0x089a083a,
+ 0x089a381a, 0x089a582a, 0x089ab802, 0x089b101a, 0x089b3062, 0x089b8042, 0x08a1a82a, 0x08a1c072, 0x08a2001a,
+ 0x08a21022, 0x08a2280a, 0x08a23002, 0x08a2f002, 0x08a58002, 0x08a5881a, 0x08a59852, 0x08a5c80a, 0x08a5d002,
+ 0x08a5d81a, 0x08a5e802, 0x08a5f00a, 0x08a5f812, 0x08a6080a, 0x08a61012, 0x08ad7802, 0x08ad801a, 0x08ad9032,
+ 0x08adc03a, 0x08ade012, 0x08adf00a, 0x08adf812, 0x08aee012, 0x08b1802a, 0x08b19872, 0x08b1d81a, 0x08b1e802,
+ 0x08b1f00a, 0x08b1f812, 0x08b55802, 0x08b5600a, 0x08b56802, 0x08b5701a, 0x08b58052, 0x08b5b00a, 0x08b5b802,
+ 0x08b8e822, 0x08b91032, 0x08b9300a, 0x08b93842, 0x08c1602a, 0x08c17882, 0x08c1c00a, 0x08c1c812, 0x08c98002,
+ 0x08c9884a, 0x08c9b81a, 0x08c9d812, 0x08c9e80a, 0x08c9f002, 0x08c9f808, 0x08ca000a, 0x08ca0808, 0x08ca100a,
+ 0x08ca1802, 0x08ce882a, 0x08cea032, 0x08ced012, 0x08cee03a, 0x08cf0002, 0x08cf200a, 0x08d00892, 0x08d19852,
+ 0x08d1c80a, 0x08d1d008, 0x08d1d832, 0x08d23802, 0x08d28852, 0x08d2b81a, 0x08d2c822, 0x08d42058, 0x08d450c2,
+ 0x08d4b80a, 0x08d4c012, 0x08e1780a, 0x08e18062, 0x08e1c052, 0x08e1f00a, 0x08e1f802, 0x08e49152, 0x08e5480a,
+ 0x08e55062, 0x08e5880a, 0x08e59012, 0x08e5a00a, 0x08e5a812, 0x08e98852, 0x08e9d002, 0x08e9e012, 0x08e9f862,
+ 0x08ea3008, 0x08ea3802, 0x08ec504a, 0x08ec8012, 0x08ec981a, 0x08eca802, 0x08ecb00a, 0x08ecb802, 0x08f79812,
+ 0x08f7a81a, 0x09a18081, 0x0b578042, 0x0b598062, 0x0b7a7802, 0x0b7a8b6a, 0x0b7c7832, 0x0b7f2002, 0x0b7f801a,
+ 0x0de4e812, 0x0de50031, 0x0e7802d2, 0x0e798162, 0x0e8b2802, 0x0e8b300a, 0x0e8b3822, 0x0e8b680a, 0x0e8b7042,
+ 0x0e8b9871, 0x0e8bd872, 0x0e8c2862, 0x0e8d5032, 0x0e921022, 0x0ed00362, 0x0ed1db12, 0x0ed3a802, 0x0ed42002,
+ 0x0ed4d842, 0x0ed508e2, 0x0f000062, 0x0f004102, 0x0f00d862, 0x0f011812, 0x0f013042, 0x0f098062, 0x0f157002,
+ 0x0f176032, 0x0f468062, 0x0f4a2062, 0x0f8007f3, 0x0f8407f3, 0x0f886823, 0x0f897803, 0x0f8b6053, 0x0f8bf013,
+ 0x0f8c7003, 0x0f8c8893, 0x0f8d6b83, 0x0f8f3199, 0x0f9008e3, 0x0f90d003, 0x0f917803, 0x0f919083, 0x0f91e033,
+ 0x0f924ff3, 0x0f964ff3, 0x0f9a4ff3, 0x0f9e4b13, 0x0f9fd842, 0x0fa007f3, 0x0fa407f3, 0x0fa803d3, 0x0faa37f3,
+ 0x0fae37f3, 0x0fb23093, 0x0fb407f3, 0x0fbba0b3, 0x0fbeaaa3, 0x0fc06033, 0x0fc24073, 0x0fc2d053, 0x0fc44073,
+ 0x0fc57513, 0x0fc862e3, 0x0fc9e093, 0x0fca3ff3, 0x0fce3ff3, 0x0fd23ff3, 0x0fd63b83, 0x0fe007f3, 0x0fe407f3,
+ 0x0fe807f3, 0x0fec07f3, 0x0ff007f3, 0x0ff407f3, 0x0ff807f3, 0x0ffc07d3, 0x700001f1, 0x700105f2, 0x700407f1,
+ 0x700807f2, 0x700c06f2, 0x700f87f1, 0x701387f1, 0x701787f1, 0x701b87f1, 0x701f87f1, 0x702387f1, 0x702787f1,
+ 0x702b87f1, 0x702f87f1, 0x703387f1, 0x703787f1, 0x703b87f1, 0x703f87f1, 0x704387f1, 0x704787f1, 0x704b87f1,
+ 0x704f87f1, 0x705387f1, 0x705787f1, 0x705b87f1, 0x705f87f1, 0x706387f1, 0x706787f1, 0x706b87f1, 0x706f87f1,
+ 0x707387f1, 0x707787f1, 0x707b87f1, 0x707f80f1};
+
+/// Returns the extended grapheme cluster bondary property of a code point.
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __property __get_property(const char32_t __code_point) noexcept {
+ // TODO FMT use std::ranges::upper_bound.
+
+ // The algorithm searches for the upper bound of the range and, when found,
+ // steps back one entry. This algorithm is used since the code point can be
+ // anywhere in the range. After a lower bound is found the next step is to
+ // compare whether the code unit is indeed in the range.
+ //
+ // Since the entry contains a code unit, size, and property the code point
+ // being sought needs to be adjusted. Just shifting the code point to the
+ // proper position doesn't work; suppose an entry has property 0, size 1,
+ // and lower bound 3. This results in the entry 0x1810.
+ // When searching for code point 3 it will search for 0x1800, find 0x1810
+ // and moves to the previous entry. Thus the lower bound value will never
+ // be found.
+ // The simple solution is to set the bits belonging to the property and
+ // size. Then the upper bound for code point 3 will return the entry after
+ // 0x1810. After moving to the previous entry the algorithm arrives at the
+ // correct entry.
+ ptrdiff_t __i = std::upper_bound(__entries, std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
+ if (__i == 0)
+ return __property::__none;
+
+ --__i;
+ uint32_t __upper_bound = (__entries[__i] >> 11) + ((__entries[__i] >> 4) & 0x7f);
+ if (__code_point <= __upper_bound)
+ return static_cast<__property>(__entries[__i] & 0xf);
+
+ return __property::__none;
+}
+
+} // namespace __extended_grapheme_custer_property_boundary
+
+#endif //_LIBCPP_STD_VER > 17
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h
index 4c9d3fc774..cdb0631f87 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h
@@ -47,6 +47,7 @@ public:
_LIBCPP_HIDE_FROM_ABI auto format(bool __value, auto& __ctx) const -> decltype(__ctx.out()) {
switch (__parser_.__type_) {
+ case __format_spec::__type::__default:
case __format_spec::__type::__string:
return __formatter::__format_bool(__value, __ctx, __parser_.__get_parsed_std_specifications(__ctx));
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h
index cd54abba34..a3ca36ec0a 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h
@@ -41,7 +41,7 @@ public:
}
_LIBCPP_HIDE_FROM_ABI auto format(_CharT __value, auto& __ctx) const -> decltype(__ctx.out()) {
- if (__parser_.__type_ == __format_spec::__type::__char)
+ if (__parser_.__type_ == __format_spec::__type::__default || __parser_.__type_ == __format_spec::__type::__char)
return __formatter::__format_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
if constexpr (sizeof(_CharT) <= sizeof(int))
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h
index 4ad6de0ec6..b9ed5fe80f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h
@@ -207,10 +207,6 @@ _LIBCPP_HIDE_FROM_ABI auto __format_integer(
char* __end,
const char* __prefix,
int __base) -> decltype(__ctx.out()) {
- _LIBCPP_ASSERT(
- __specs.__alignment_ != __format_spec::__alignment::__default,
- "the caller should adjust the default to the value required by the type");
-
char* __first = __formatter::__insert_sign(__begin, __negative, __specs.__std_.__sign_);
if (__specs.__std_.__alternate_form_ && __prefix)
while (*__prefix)
@@ -280,6 +276,7 @@ _LIBCPP_HIDE_FROM_ABI auto __format_integer(
return __formatter::__format_integer(
__value, __ctx, __specs, __negative, __array.begin(), __array.end(), __value != 0 ? "0" : nullptr, 8);
}
+ case __format_spec::__type::__default:
case __format_spec::__type::__decimal: {
array<char, __formatter::__buffer_size<decltype(__value), 10>()> __array;
return __formatter::__format_integer(
@@ -346,7 +343,7 @@ __format_bool(bool __value, auto& __ctx, __format_spec::__parsed_specifications<
if (__specs.__std_.__locale_specific_form_) {
const auto& __np = use_facet<numpunct<_CharT>>(__ctx.locale());
basic_string<_CharT> __str = __value ? __np.truename() : __np.falsename();
- return __formatter::__write_unicode_no_precision(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
+ return __formatter::__write_string_no_precision(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
}
# endif
basic_string_view<_CharT> __str =
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h
index fabc04b9a0..e09534c41d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h
@@ -17,6 +17,7 @@
#include <__config>
#include <__format/formatter.h>
#include <__format/parser_std_format_spec.h>
+#include <__format/unicode.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
#include <cstddef>
@@ -59,14 +60,11 @@ struct _LIBCPP_TYPE_VIS __padding_size_result {
_LIBCPP_HIDE_FROM_ABI constexpr __padding_size_result
__padding_size(size_t __size, size_t __width, __format_spec::__alignment __align) {
_LIBCPP_ASSERT(__width > __size, "don't call this function when no padding is required");
- _LIBCPP_ASSERT(__align != __format_spec::__alignment::__default,
- "the caller should adjust the default to the value required by the type");
- _LIBCPP_ASSERT(__align != __format_spec::__alignment::__zero_padding,
- "the caller should have handled the zero-padding");
+ _LIBCPP_ASSERT(
+ __align != __format_spec::__alignment::__zero_padding, "the caller should have handled the zero-padding");
size_t __fill = __width - __size;
switch (__align) {
- case __format_spec::__alignment::__default:
case __format_spec::__alignment::__zero_padding:
__libcpp_unreachable();
@@ -78,9 +76,10 @@ __padding_size(size_t __size, size_t __width, __format_spec::__alignment __align
// __before = floor(__fill, 2);
// __after = ceil(__fill, 2);
size_t __before = __fill / 2;
- size_t __after = __fill - __before;
+ size_t __after = __fill - __before;
return {__before, __after};
}
+ case __format_spec::__alignment::__default:
case __format_spec::__alignment::__right:
return {__fill, 0};
}
@@ -91,9 +90,6 @@ template <class _OutIt, class _CharT>
_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, const char* __begin, const char* __first,
const char* __last, string&& __grouping, _CharT __sep,
__format_spec::__parsed_specifications<_CharT> __specs) {
- _LIBCPP_ASSERT(__specs.__alignment_ != __format_spec::__alignment::__default,
- "the caller should adjust the default to the value required by the type");
-
int __size = (__first - __begin) + // [sign][prefix]
(__last - __first) + // data
(__grouping.size() - 1); // number of separator characters
@@ -178,10 +174,12 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
/// conversion, which means the [\a __first, \a __last) always contains elements
/// of the type \c char.
template <class _CharT, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto __write(const _CharT* __first, const _CharT* __last,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs, ptrdiff_t __size)
- -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __write(
+ const _CharT* __first,
+ const _CharT* __last,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_ParserCharT> __specs,
+ ptrdiff_t __size) -> decltype(__out_it) {
_LIBCPP_ASSERT(__first <= __last, "Not a valid range");
if (__size >= __specs.__width_)
@@ -194,6 +192,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write(const _CharT* __first, const _CharT* __last,
}
/// \overload
+///
/// Calls the function above where \a __size = \a __last - \a __first.
template <class _CharT, class _ParserCharT>
_LIBCPP_HIDE_FROM_ABI auto __write(const _CharT* __first, const _CharT* __last,
@@ -248,77 +247,56 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
return _VSTD::fill_n(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_);
}
-# ifndef _LIBCPP_HAS_NO_UNICODE
+/// Writes a string using format's width estimation algorithm.
+///
+/// \pre !__specs.__has_precision()
+///
+/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
+/// input is ASCII.
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_unicode_no_precision(basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs)
- -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision(
+ basic_string_view<_CharT> __str,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
+ _LIBCPP_ASSERT(!__specs.__has_precision(), "use __write_string");
- _LIBCPP_ASSERT(!__specs.__has_precision(), "use __write_unicode");
// No padding -> copy the string
if (!__specs.__has_width())
return _VSTD::copy(__str.begin(), __str.end(), _VSTD::move(__out_it));
- // Non Unicode part larger than width -> copy the string
- auto __last = __format_spec::__detail::__estimate_column_width_fast(__str.begin(), __str.end());
- ptrdiff_t __size = __last - __str.begin();
- if (__size >= __specs.__width_)
- return _VSTD::copy(__str.begin(), __str.end(), _VSTD::move(__out_it));
-
- // Is there a non Unicode part?
- if (__last != __str.end()) {
- // Non Unicode and Unicode part larger than width -> copy the string
- __format_spec::__detail::__column_width_result __column_width =
- __format_spec::__detail::__estimate_column_width(__last, __str.end(), __specs.__width_);
- __size += __column_width.__width; // Note this new size is used when __size < __specs.__width_
- if (__size >= __specs.__width_)
- return _VSTD::copy(__str.begin(), __str.end(), _VSTD::move(__out_it));
- }
+ // Note when the estimated width is larger than size there's no padding. So
+ // there's no reason to get the real size when the estimate is larger than or
+ // equal to the minimum field width.
+ size_t __size =
+ __format_spec::__estimate_column_width(__str, __specs.__width_, __format_spec::__column_width_rounding::__up)
+ .__width_;
return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size);
}
-# endif
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_unicode(basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs)
- -> decltype(__out_it) {
-# ifndef _LIBCPP_HAS_NO_UNICODE
- if (!__specs.__has_precision())
- return __formatter::__write_unicode_no_precision(__str, _VSTD::move(__out_it), __specs);
-
- // Non unicode part larger than precision -> truncate the output and use the normal write operation.
- auto __last = __format_spec::__detail::__estimate_column_width_fast(__str.begin(), __str.end());
- ptrdiff_t __size = __last - __str.begin();
- if (__size >= __specs.__precision_)
- return __formatter::__write(__str.begin(), __str.begin() + __specs.__precision_, _VSTD::move(__out_it), __specs,
- __specs.__precision_);
-
- // No non Unicode part, implies __size < __specs.__precision_ -> use normal write operation
- if (__last == __str.end())
- return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __str.size());
-
- __format_spec::__detail::__column_width_result __column_width =
- __format_spec::__detail::__estimate_column_width(__last, __str.end(), __specs.__precision_ - __size);
- __size += __column_width.__width;
- // Truncate the output
- if (__column_width.__ptr != __str.end())
- __str.remove_suffix(__str.end() - __column_width.__ptr);
+_LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __precision) {
+ __format_spec::__column_width_result<_CharT> __result =
+ __format_spec::__estimate_column_width(__str, __precision, __format_spec::__column_width_rounding::__down);
+ __str = basic_string_view<_CharT>{__str.begin(), __result.__last_};
+ return __result.__width_;
+}
- return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size);
+/// Writes a string using format's width estimation algorithm.
+///
+/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
+/// input is ASCII.
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI auto __write_string(
+ basic_string_view<_CharT> __str,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
+ if (!__specs.__has_precision())
+ return __formatter::__write_string_no_precision(__str, _VSTD::move(__out_it), __specs);
-# else
- if (__specs.__has_precision()) {
- ptrdiff_t __size = __str.size();
- if (__size > __specs.__precision_)
- return __formatter::__write(__str.begin(), __str.begin() + __specs.__precision_, _VSTD::move(__out_it), __specs,
- __specs.__precision_);
- }
- return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __str.size());
+ int __size = __formatter::__truncate(__str, __specs.__precision_);
-# endif
+ return __write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size);
}
} // namespace __formatter
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h
index 139c05e58c..71bda4fcde 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h
@@ -40,7 +40,7 @@ public:
}
_LIBCPP_HIDE_FROM_ABI auto format(basic_string_view<_CharT> __str, auto& __ctx) const -> decltype(__ctx.out()) {
- return __formatter::__write_unicode(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
+ return __formatter::__write_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
}
__format_spec::__parser<_CharT> __parser_;
@@ -69,7 +69,7 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT*,
// TODO FMT Implement these improvements.
__format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx);
if (__specs.__has_width() || __specs.__has_precision())
- return __formatter::__write_unicode(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
+ return __formatter::__write_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
// No formatting required, copy the string to the output.
auto __out_it = __ctx.out();
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h
index 319ef24d3e..1425a953eb 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h
@@ -25,10 +25,12 @@
#include <__format/format_error.h>
#include <__format/format_parse_context.h>
#include <__format/format_string.h>
+#include <__format/unicode.h>
#include <__variant/monostate.h>
#include <bit>
#include <concepts>
#include <cstdint>
+#include <string_view>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -91,462 +93,6 @@ __substitute_arg_id(basic_format_arg<_Context> __format_arg) {
__format_arg);
}
-/** Helper struct returned from @ref __get_string_alignment. */
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __string_alignment {
- /** Points beyond the last character to write to the output. */
- const _CharT* __last;
- /**
- * The estimated number of columns in the output or 0.
- *
- * Only when the output needs to be aligned it's required to know the exact
- * number of columns in the output. So if the formatted output has only a
- * minimum width the exact size isn't important. It's only important to know
- * the minimum has been reached. The minimum width is the width specified in
- * the format-spec.
- *
- * For example in this code @code std::format("{:10}", MyString); @endcode
- * the width estimation can stop once the algorithm has determined the output
- * width is 10 columns.
- *
- * So if:
- * * @ref __align == @c true the @ref __size is the estimated number of
- * columns required.
- * * @ref __align == @c false the @ref __size is the estimated number of
- * columns required or 0 when the estimation algorithm stopped prematurely.
- */
- ptrdiff_t __size;
- /**
- * Does the output need to be aligned.
- *
- * When alignment is needed the output algorithm needs to add the proper
- * padding. Else the output algorithm just needs to copy the input up to
- * @ref __last.
- */
- bool __align;
-};
-
-#ifndef _LIBCPP_HAS_NO_UNICODE
-namespace __detail {
-
-/**
- * Unicode column width estimates.
- *
- * Unicode can be stored in several formats: UTF-8, UTF-16, and UTF-32.
- * Depending on format the relation between the number of code units stored and
- * the number of output columns differs. The first relation is the number of
- * code units forming a code point. (The text assumes the code units are
- * unsigned.)
- * - UTF-8 The number of code units is between one and four. The first 127
- * Unicode code points match the ASCII character set. When the highest bit is
- * set it means the code point has more than one code unit.
- * - UTF-16: The number of code units is between 1 and 2. When the first
- * code unit is in the range [0xd800,0xdfff) it means the code point uses two
- * code units.
- * - UTF-32: The number of code units is always one.
- *
- * The code point to the number of columns isn't well defined. The code uses the
- * estimations defined in [format.string.std]/11. This list might change in the
- * future.
- *
- * The algorithm of @ref __get_string_alignment uses two different scanners:
- * - The simple scanner @ref __estimate_column_width_fast. This scanner assumes
- * 1 code unit is 1 column. This scanner stops when it can't be sure the
- * assumption is valid:
- * - UTF-8 when the code point is encoded in more than 1 code unit.
- * - UTF-16 and UTF-32 when the first multi-column code point is encountered.
- * (The code unit's value is lower than 0xd800 so the 2 code unit encoding
- * is irrelevant for this scanner.)
- * Due to these assumptions the scanner is faster than the full scanner. It
- * can process all text only containing ASCII. For UTF-16/32 it can process
- * most (all?) European languages. (Note the set it can process might be
- * reduced in the future, due to updates in the scanning rules.)
- * - The full scanner @ref __estimate_column_width. This scanner, if needed,
- * converts multiple code units into one code point then converts the code
- * point to a column width.
- *
- * See also:
- * - [format.string.general]/11
- * - https://en.wikipedia.org/wiki/UTF-8#Encoding
- * - https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF
- */
-
-/**
- * The first 2 column code point.
- *
- * This is the point where the fast UTF-16/32 scanner needs to stop processing.
- */
-inline constexpr uint32_t __two_column_code_point = 0x1100;
-
-/** Helper concept for an UTF-8 character type. */
-template <class _CharT>
-concept __utf8_character = same_as<_CharT, char> || same_as<_CharT, char8_t>;
-
-/** Helper concept for an UTF-16 character type. */
-template <class _CharT>
-concept __utf16_character = (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2) || same_as<_CharT, char16_t>;
-
-/** Helper concept for an UTF-32 character type. */
-template <class _CharT>
-concept __utf32_character = (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4) || same_as<_CharT, char32_t>;
-
-/** Helper concept for an UTF-16 or UTF-32 character type. */
-template <class _CharT>
-concept __utf16_or_32_character = __utf16_character<_CharT> || __utf32_character<_CharT>;
-
-/**
- * Converts a code point to the column width.
- *
- * The estimations are conforming to [format.string.general]/11
- *
- * This version expects a value less than 0x1'0000, which is a 3-byte UTF-8
- * character.
- */
-_LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width_3(uint32_t __c) noexcept {
- _LIBCPP_ASSERT(__c < 0x10000,
- "Use __column_width_4 or __column_width for larger values");
-
- // clang-format off
- return 1 + (__c >= 0x1100 && (__c <= 0x115f ||
- (__c >= 0x2329 && (__c <= 0x232a ||
- (__c >= 0x2e80 && (__c <= 0x303e ||
- (__c >= 0x3040 && (__c <= 0xa4cf ||
- (__c >= 0xac00 && (__c <= 0xd7a3 ||
- (__c >= 0xf900 && (__c <= 0xfaff ||
- (__c >= 0xfe10 && (__c <= 0xfe19 ||
- (__c >= 0xfe30 && (__c <= 0xfe6f ||
- (__c >= 0xff00 && (__c <= 0xff60 ||
- (__c >= 0xffe0 && (__c <= 0xffe6
- ))))))))))))))))))));
- // clang-format on
-}
-
-/**
- * @overload
- *
- * This version expects a value greater than or equal to 0x1'0000, which is a
- * 4-byte UTF-8 character.
- */
-_LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width_4(uint32_t __c) noexcept {
- _LIBCPP_ASSERT(__c >= 0x10000,
- "Use __column_width_3 or __column_width for smaller values");
-
- // clang-format off
- return 1 + (__c >= 0x1'f300 && (__c <= 0x1'f64f ||
- (__c >= 0x1'f900 && (__c <= 0x1'f9ff ||
- (__c >= 0x2'0000 && (__c <= 0x2'fffd ||
- (__c >= 0x3'0000 && (__c <= 0x3'fffd
- ))))))));
- // clang-format on
-}
-
-/**
- * @overload
- *
- * The general case, accepting all values.
- */
-_LIBCPP_HIDE_FROM_ABI inline constexpr int __column_width(uint32_t __c) noexcept {
- if (__c < 0x10000)
- return __column_width_3(__c);
-
- return __column_width_4(__c);
-}
-
-/**
- * Estimate the column width for the UTF-8 sequence using the fast algorithm.
- */
-template <__utf8_character _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr const _CharT*
-__estimate_column_width_fast(const _CharT* __first,
- const _CharT* __last) noexcept {
- return _VSTD::find_if(__first, __last,
- [](unsigned char __c) { return __c & 0x80; });
-}
-
-/**
- * @overload
- *
- * The implementation for UTF-16/32.
- */
-template <__utf16_or_32_character _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr const _CharT*
-__estimate_column_width_fast(const _CharT* __first,
- const _CharT* __last) noexcept {
- return _VSTD::find_if(__first, __last,
- [](uint32_t __c) { return __c >= 0x1100; });
-}
-
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __column_width_result {
- /** The number of output columns. */
- size_t __width;
- /**
- * The last parsed element.
- *
- * This limits the original output to fit in the wanted number of columns.
- */
- const _CharT* __ptr;
-};
-
-/**
- * Small helper to determine the width of malformed Unicode.
- *
- * @note This function's only needed for UTF-8. During scanning UTF-8 there
- * are multiple place where it can be detected that the Unicode is malformed.
- * UTF-16 only requires 1 test and UTF-32 requires no testing.
- */
-template <__utf8_character _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT>
-__estimate_column_width_malformed(const _CharT* __first, const _CharT* __last,
- size_t __maximum, size_t __result) noexcept {
- size_t __size = __last - __first;
- size_t __n = _VSTD::min(__size, __maximum);
- return {__result + __n, __first + __n};
-}
-
-/**
- * Determines the number of output columns needed to render the input.
- *
- * @note When the scanner encounters malformed Unicode it acts as-if every code
- * unit at the end of the input is one output column. It's expected the output
- * terminal will replace these malformed code units with a one column
- * replacement characters.
- *
- * @param __first Points to the first element of the input range.
- * @param __last Points beyond the last element of the input range.
- * @param __maximum The maximum number of output columns. The returned number
- * of estimated output columns will not exceed this value.
- */
-template <__utf8_character _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT>
-__estimate_column_width(const _CharT* __first, const _CharT* __last,
- size_t __maximum) noexcept {
- size_t __result = 0;
-
- while (__first != __last) {
- // Based on the number of leading 1 bits the number of code units in the
- // code point can be determined. See
- // https://en.wikipedia.org/wiki/UTF-8#Encoding
- switch (_VSTD::countl_one(static_cast<unsigned char>(*__first))) {
- case 0: // 1-code unit encoding: all 1 column
- ++__result;
- ++__first;
- break;
-
- case 2: // 2-code unit encoding: all 1 column
- // Malformed Unicode.
- if (__last - __first < 2) [[unlikely]]
- return __estimate_column_width_malformed(__first, __last, __maximum,
- __result);
- __first += 2;
- ++__result;
- break;
-
- case 3: // 3-code unit encoding: either 1 or 2 columns
- // Malformed Unicode.
- if (__last - __first < 3) [[unlikely]]
- return __estimate_column_width_malformed(__first, __last, __maximum,
- __result);
- {
- uint32_t __c = static_cast<unsigned char>(*__first++) & 0x0f;
- __c <<= 6;
- __c |= static_cast<unsigned char>(*__first++) & 0x3f;
- __c <<= 6;
- __c |= static_cast<unsigned char>(*__first++) & 0x3f;
- __result += __column_width_3(__c);
- if (__result > __maximum)
- return {__result - 2, __first - 3};
- }
- break;
- case 4: // 4-code unit encoding: either 1 or 2 columns
- // Malformed Unicode.
- if (__last - __first < 4) [[unlikely]]
- return __estimate_column_width_malformed(__first, __last, __maximum,
- __result);
- {
- uint32_t __c = static_cast<unsigned char>(*__first++) & 0x07;
- __c <<= 6;
- __c |= static_cast<unsigned char>(*__first++) & 0x3f;
- __c <<= 6;
- __c |= static_cast<unsigned char>(*__first++) & 0x3f;
- __c <<= 6;
- __c |= static_cast<unsigned char>(*__first++) & 0x3f;
- __result += __column_width_4(__c);
- if (__result > __maximum)
- return {__result - 2, __first - 4};
- }
- break;
- default:
- // Malformed Unicode.
- return __estimate_column_width_malformed(__first, __last, __maximum,
- __result);
- }
-
- if (__result >= __maximum)
- return {__result, __first};
- }
- return {__result, __first};
-}
-
-template <__utf16_character _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT>
-__estimate_column_width(const _CharT* __first, const _CharT* __last,
- size_t __maximum) noexcept {
- size_t __result = 0;
-
- while (__first != __last) {
- uint32_t __c = *__first;
- // Is the code unit part of a surrogate pair? See
- // https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF
- if (__c >= 0xd800 && __c <= 0xDfff) {
- // Malformed Unicode.
- if (__last - __first < 2) [[unlikely]]
- return {__result + 1, __first + 1};
-
- __c -= 0xd800;
- __c <<= 10;
- __c += (*(__first + 1) - 0xdc00);
- __c += 0x10000;
-
- __result += __column_width_4(__c);
- if (__result > __maximum)
- return {__result - 2, __first};
- __first += 2;
- } else {
- __result += __column_width_3(__c);
- if (__result > __maximum)
- return {__result - 2, __first};
- ++__first;
- }
-
- if (__result >= __maximum)
- return {__result, __first};
- }
-
- return {__result, __first};
-}
-
-template <__utf32_character _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT>
-__estimate_column_width(const _CharT* __first, const _CharT* __last,
- size_t __maximum) noexcept {
- size_t __result = 0;
-
- while (__first != __last) {
- uint32_t __c = *__first;
- __result += __column_width(__c);
-
- if (__result > __maximum)
- return {__result - 2, __first};
-
- ++__first;
- if (__result >= __maximum)
- return {__result, __first};
- }
-
- return {__result, __first};
-}
-
-} // namespace __detail
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __string_alignment<_CharT>
-__get_string_alignment(const _CharT* __first, const _CharT* __last,
- ptrdiff_t __width, ptrdiff_t __precision) noexcept {
- _LIBCPP_ASSERT(__width != 0 || __precision != -1,
- "The function has no effect and shouldn't be used");
-
- // TODO FMT There might be more optimizations possible:
- // If __precision == __format::__number_max and the encoding is:
- // * UTF-8 : 4 * (__last - __first) >= __width
- // * UTF-16 : 2 * (__last - __first) >= __width
- // * UTF-32 : (__last - __first) >= __width
- // In these cases it's certain the output is at least the requested width.
- // It's unknown how often this happens in practice. For now the improvement
- // isn't implemented.
-
- /*
- * First assume there are no special Unicode code units in the input.
- * - Apply the precision (this may reduce the size of the input). When
- * __precison == -1 this step is omitted.
- * - Scan for special code units in the input.
- * If our assumption was correct the __pos will be at the end of the input.
- */
- const ptrdiff_t __length = __last - __first;
- const _CharT* __limit =
- __first +
- (__precision == -1 ? __length : _VSTD::min(__length, __precision));
- ptrdiff_t __size = __limit - __first;
- const _CharT* __pos =
- __detail::__estimate_column_width_fast(__first, __limit);
-
- if (__pos == __limit)
- return {__limit, __size, __size < __width};
-
- /*
- * Our assumption was wrong, there are special Unicode code units.
- * The range [__first, __pos) contains a set of code units with the
- * following property:
- * Every _CharT in the range will be rendered in 1 column.
- *
- * If there's no maximum width and the parsed size already exceeds the
- * minimum required width. The real size isn't important. So bail out.
- */
- if (__precision == -1 && (__pos - __first) >= __width)
- return {__last, 0, false};
-
- /* If there's a __precision, truncate the output to that width. */
- ptrdiff_t __prefix = __pos - __first;
- if (__precision != -1) {
- _LIBCPP_ASSERT(__precision > __prefix, "Logic error.");
- auto __lengh_info = __detail::__estimate_column_width(
- __pos, __last, __precision - __prefix);
- __size = __lengh_info.__width + __prefix;
- return {__lengh_info.__ptr, __size, __size < __width};
- }
-
- /* Else use __width to determine the number of required padding characters. */
- _LIBCPP_ASSERT(__width > __prefix, "Logic error.");
- /*
- * The column width is always one or two columns. For the precision the wanted
- * column width is the maximum, for the width it's the minimum. Using the
- * width estimation with its truncating behavior will result in the wrong
- * result in the following case:
- * - The last code unit processed requires two columns and exceeds the
- * maximum column width.
- * By increasing the __maximum by one avoids this issue. (It means it may
- * pass one code point more than required to determine the proper result;
- * that however isn't a problem for the algorithm.)
- */
- size_t __maximum = 1 + __width - __prefix;
- auto __lengh_info =
- __detail::__estimate_column_width(__pos, __last, __maximum);
- if (__lengh_info.__ptr != __last) {
- // Consumed the width number of code units. The exact size of the string
- // is unknown. We only know we don't need to align the output.
- _LIBCPP_ASSERT(static_cast<ptrdiff_t>(__lengh_info.__width + __prefix) >=
- __width,
- "Logic error");
- return {__last, 0, false};
- }
-
- __size = __lengh_info.__width + __prefix;
- return {__last, __size, __size < __width};
-}
-#else // _LIBCPP_HAS_NO_UNICODE
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __string_alignment<_CharT>
-__get_string_alignment(const _CharT* __first, const _CharT* __last,
- ptrdiff_t __width, ptrdiff_t __precision) noexcept {
- const ptrdiff_t __length = __last - __first;
- const _CharT* __limit =
- __first +
- (__precision == -1 ? __length : _VSTD::min(__length, __precision));
- ptrdiff_t __size = __limit - __first;
- return {__limit, __size, __size < __width};
-}
-#endif // _LIBCPP_HAS_NO_UNICODE
-
/// These fields are a filter for which elements to parse.
///
/// They default to false so when a new field is added it needs to be opted in
@@ -1041,17 +587,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_char(__parser<_CharT
}
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_integer(__parser<_CharT>& __parser) {
- if (__parser.__alignment_ == __alignment::__default)
- __parser.__alignment_ = __alignment::__right;
-}
-
-template <class _CharT>
_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_bool(__parser<_CharT>& __parser) {
switch (__parser.__type_) {
case __format_spec::__type::__default:
- __parser.__type_ = __format_spec::__type::__string;
- [[fallthrough]];
case __format_spec::__type::__string:
__format_spec::__process_display_type_bool_string(__parser);
break;
@@ -1062,7 +600,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_bool(__parser<_CharT>& __p
case __format_spec::__type::__decimal:
case __format_spec::__type::__hexadecimal_lower_case:
case __format_spec::__type::__hexadecimal_upper_case:
- __process_display_type_integer(__parser);
break;
default:
@@ -1074,8 +611,6 @@ template <class _CharT>
_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __parser) {
switch (__parser.__type_) {
case __format_spec::__type::__default:
- __parser.__type_ = __format_spec::__type::__char;
- [[fallthrough]];
case __format_spec::__type::__char:
__format_spec::__process_display_type_char(__parser);
break;
@@ -1086,7 +621,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __p
case __format_spec::__type::__decimal:
case __format_spec::__type::__hexadecimal_lower_case:
case __format_spec::__type::__hexadecimal_upper_case:
- __format_spec::__process_display_type_integer(__parser);
break;
default:
@@ -1098,15 +632,12 @@ template <class _CharT>
_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_integer(__parser<_CharT>& __parser) {
switch (__parser.__type_) {
case __format_spec::__type::__default:
- __parser.__type_ = __format_spec::__type::__decimal;
- [[fallthrough]];
case __format_spec::__type::__binary_lower_case:
case __format_spec::__type::__binary_upper_case:
case __format_spec::__type::__octal:
case __format_spec::__type::__decimal:
case __format_spec::__type::__hexadecimal_lower_case:
case __format_spec::__type::__hexadecimal_upper_case:
- __format_spec::__process_display_type_integer(__parser);
break;
case __format_spec::__type::__char:
@@ -1120,8 +651,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_integer(__parser<_CharT>&
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_floating_point(__parser<_CharT>& __parser) {
- __format_spec::__process_display_type_integer(__parser);
-
switch (__parser.__type_) {
case __format_spec::__type::__default:
// When no precision specified then it keeps default since that
@@ -1160,6 +689,212 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_pointer(__format_spe
}
}
+template <class _CharT>
+struct __column_width_result {
+ /// The number of output columns.
+ size_t __width_;
+ /// One beyond the last code unit used in the estimation.
+ ///
+ /// This limits the original output to fit in the wanted number of columns.
+ const _CharT* __last_;
+};
+
+/// Since a column width can be two it's possible that the requested column
+/// width can't be achieved. Depending on the intended usage the policy can be
+/// selected.
+/// - When used as precision the maximum width may not be exceeded and the
+/// result should be "rounded down" to the previous boundary.
+/// - When used as a width we're done once the minimum is reached, but
+/// exceeding is not an issue. Rounding down is an issue since that will
+/// result in writing fill characters. Therefore the result needs to be
+/// "rounded up".
+enum class __column_width_rounding { __down, __up };
+
+# ifndef _LIBCPP_HAS_NO_UNICODE
+
+namespace __detail {
+
+/// Converts a code point to the column width.
+///
+/// The estimations are conforming to [format.string.general]/11
+///
+/// This version expects a value less than 0x1'0000, which is a 3-byte UTF-8
+/// character.
+_LIBCPP_HIDE_FROM_ABI constexpr int __column_width_3(uint32_t __c) noexcept {
+ _LIBCPP_ASSERT(__c < 0x10000, "Use __column_width_4 or __column_width for larger values");
+
+ // clang-format off
+ return 1 + (__c >= 0x1100 && (__c <= 0x115f ||
+ (__c >= 0x2329 && (__c <= 0x232a ||
+ (__c >= 0x2e80 && (__c <= 0x303e ||
+ (__c >= 0x3040 && (__c <= 0xa4cf ||
+ (__c >= 0xac00 && (__c <= 0xd7a3 ||
+ (__c >= 0xf900 && (__c <= 0xfaff ||
+ (__c >= 0xfe10 && (__c <= 0xfe19 ||
+ (__c >= 0xfe30 && (__c <= 0xfe6f ||
+ (__c >= 0xff00 && (__c <= 0xff60 ||
+ (__c >= 0xffe0 && (__c <= 0xffe6
+ ))))))))))))))))))));
+ // clang-format on
+}
+
+/// @overload
+///
+/// This version expects a value greater than or equal to 0x1'0000, which is a
+/// 4-byte UTF-8 character.
+_LIBCPP_HIDE_FROM_ABI constexpr int __column_width_4(uint32_t __c) noexcept {
+ _LIBCPP_ASSERT(__c >= 0x10000, "Use __column_width_3 or __column_width for smaller values");
+
+ // clang-format off
+ return 1 + (__c >= 0x1'f300 && (__c <= 0x1'f64f ||
+ (__c >= 0x1'f900 && (__c <= 0x1'f9ff ||
+ (__c >= 0x2'0000 && (__c <= 0x2'fffd ||
+ (__c >= 0x3'0000 && (__c <= 0x3'fffd
+ ))))))));
+ // clang-format on
+}
+
+/// @overload
+///
+/// The general case, accepting all values.
+_LIBCPP_HIDE_FROM_ABI constexpr int __column_width(uint32_t __c) noexcept {
+ if (__c < 0x10000)
+ return __detail::__column_width_3(__c);
+
+ return __detail::__column_width_4(__c);
+}
+
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_width_grapheme_clustering(
+ const _CharT* __first, const _CharT* __last, size_t __maximum, __column_width_rounding __rounding) noexcept {
+ __unicode::__extended_grapheme_cluster_view<_CharT> __view{__first, __last};
+
+ __column_width_result<_CharT> __result{0, __first};
+ while (__result.__last_ != __last && __result.__width_ <= __maximum) {
+ typename __unicode::__extended_grapheme_cluster_view<_CharT>::__cluster __cluster = __view.__consume();
+ int __width = __detail::__column_width(__cluster.__code_point_);
+
+ // When the next entry would exceed the maximum width the previous width
+ // might be returned. For example when a width of 100 is requested the
+ // returned width might be 99, since the next code point has an estimated
+ // column width of 2. This depends on the rounding flag.
+ // When the maximum is exceeded the loop will abort the next iteration.
+ if (__rounding == __column_width_rounding::__down && __result.__width_ + __width > __maximum)
+ return __result;
+
+ __result.__width_ += __width;
+ __result.__last_ = __cluster.__last_;
+ }
+
+ return __result;
+}
+
+} // namespace __detail
+
+// Unicode can be stored in several formats: UTF-8, UTF-16, and UTF-32.
+// Depending on format the relation between the number of code units stored and
+// the number of output columns differs. The first relation is the number of
+// code units forming a code point. (The text assumes the code units are
+// unsigned.)
+// - UTF-8 The number of code units is between one and four. The first 127
+// Unicode code points match the ASCII character set. When the highest bit is
+// set it means the code point has more than one code unit.
+// - UTF-16: The number of code units is between 1 and 2. When the first
+// code unit is in the range [0xd800,0xdfff) it means the code point uses two
+// code units.
+// - UTF-32: The number of code units is always one.
+//
+// The code point to the number of columns is specified in
+// [format.string.std]/11. This list might change in the future.
+//
+// Another thing to be taken into account is Grapheme clustering. This means
+// that in some cases multiple code points are combined one element in the
+// output. For example:
+// - an ASCII character with a combined diacritical mark
+// - an emoji with a skin tone modifier
+// - a group of combined people emoji to create a family
+// - a combination of flag emoji
+//
+// See also:
+// - [format.string.general]/11
+// - https://en.wikipedia.org/wiki/UTF-8#Encoding
+// - https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF
+
+_LIBCPP_HIDE_FROM_ABI constexpr bool __is_ascii(char32_t __c) { return __c < 0x80; }
+
+/// Determines the number of output columns needed to render the input.
+///
+/// \note When the scanner encounters malformed Unicode it acts as-if every
+/// code unit is a one column code point. Typically a terminal uses the same
+/// strategy and replaces every malformed code unit with a one column
+/// replacement character.
+///
+/// \param __first Points to the first element of the input range.
+/// \param __last Points beyond the last element of the input range.
+/// \param __maximum The maximum number of output columns. The returned number
+/// of estimated output columns will not exceed this value.
+/// \param __rounding Selects the rounding method.
+/// \c __down result.__width_ <= __maximum
+/// \c __up result.__width_ <= __maximum + 1
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_width(
+ basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding __rounding) noexcept {
+ // The width estimation is done in two steps:
+ // - Quickly process for the ASCII part. ASCII has the following properties
+ // - One code unit is one code point
+ // - Every code point has an estimated width of one
+ // - When needed it will a Unicode Grapheme clustering algorithm to find
+ // the proper place for truncation.
+
+ if (__str.empty() || __maximum == 0)
+ return {0, __str.begin()};
+
+ // ASCII has one caveat; when an ASCII character is followed by a non-ASCII
+ // character they might be part of an extended grapheme cluster. For example:
+ // an ASCII letter and a COMBINING ACUTE ACCENT
+ // The truncate should happen after the COMBINING ACUTE ACCENT. Therefore we
+ // need to scan one code unit beyond the requested precision. When this code
+ // unit is non-ASCII we omit the current code unit and let the Grapheme
+ // clustering algorithm do its work.
+ const _CharT* __it = __str.begin();
+ if (__is_ascii(*__it)) {
+ do {
+ --__maximum;
+ ++__it;
+ if (__it == __str.end())
+ return {__str.size(), __str.end()};
+
+ if (__maximum == 0) {
+ if (__is_ascii(*__it))
+ return {static_cast<size_t>(__it - __str.begin()), __it};
+
+ break;
+ }
+ } while (__is_ascii(*__it));
+ --__it;
+ ++__maximum;
+ }
+
+ ptrdiff_t __ascii_size = __it - __str.begin();
+ __column_width_result __result =
+ __detail::__estimate_column_width_grapheme_clustering(__it, __str.end(), __maximum, __rounding);
+
+ __result.__width_ += __ascii_size;
+ return __result;
+}
+# else // !defined(_LIBCPP_HAS_NO_UNICODE)
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT>
+__estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding) noexcept {
+ // When Unicode isn't supported assume ASCII and every code unit is one code
+ // point. In ASCII the estimated column width is always one. Thus there's no
+ // need for rounding.
+ size_t __width_ = _VSTD::min(__str.size(), __maximum);
+ return {__width_, __str.begin() + __width_};
+}
+
+# endif // !defined(_LIBCPP_HAS_NO_UNICODE)
+
} // namespace __format_spec
#endif //_LIBCPP_STD_VER > 17
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h b/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h
new file mode 100644
index 0000000000..3316217f4a
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h
@@ -0,0 +1,339 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FORMAT_UNICODE_H
+#define _LIBCPP___FORMAT_UNICODE_H
+
+#include <__assert>
+#include <__config>
+#include <__format/extended_grapheme_cluster_table.h>
+#include <__utility/unreachable.h>
+#include <bit>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17
+
+# ifndef _LIBCPP_HAS_NO_UNICODE
+
+/// Implements the grapheme cluster boundary rules
+///
+/// These rules are used to implement format's width estimation as stated in
+/// [format.string.std]/11
+///
+/// The Standard refers to UAX \#29 for Unicode 12.0.0
+/// https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules
+///
+/// The data tables used are
+/// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt
+/// https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
+/// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt (for testing only)
+
+namespace __unicode {
+
+inline constexpr char32_t __replacement_character = U'\ufffd';
+
+_LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(const char* __char, int __count) {
+ do {
+ if ((*__char & 0b1000'0000) != 0b1000'0000)
+ return false;
+ --__count;
+ ++__char;
+ } while (__count);
+ return true;
+}
+
+/// Helper class to extract a code unit from a Unicode character range.
+///
+/// The stored range is a view. There are multiple specialization for different
+/// character types.
+template <class _CharT>
+class __code_point_view;
+
+/// UTF-8 specialization.
+template <>
+class __code_point_view<char> {
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const char* __first, const char* __last)
+ : __first_(__first), __last_(__last) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const char* __position() const noexcept { return __first_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr char32_t __consume() noexcept {
+ _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input");
+
+ // Based on the number of leading 1 bits the number of code units in the
+ // code point can be determined. See
+ // https://en.wikipedia.org/wiki/UTF-8#Encoding
+ switch (_VSTD::countl_one(static_cast<unsigned char>(*__first_))) {
+ case 0:
+ return *__first_++;
+
+ case 2:
+ if (__last_ - __first_ < 2 || !__unicode::__is_continuation(__first_ + 1, 1)) [[unlikely]]
+ break;
+ else {
+ char32_t __value = static_cast<unsigned char>(*__first_++) & 0x1f;
+ __value <<= 6;
+ __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
+ return __value;
+ }
+
+ case 3:
+ if (__last_ - __first_ < 3 || !__unicode::__is_continuation(__first_ + 1, 2)) [[unlikely]]
+ break;
+ else {
+ char32_t __value = static_cast<unsigned char>(*__first_++) & 0x0f;
+ __value <<= 6;
+ __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
+ __value <<= 6;
+ __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
+ return __value;
+ }
+
+ case 4:
+ if (__last_ - __first_ < 4 || !__unicode::__is_continuation(__first_ + 1, 3)) [[unlikely]]
+ break;
+ else {
+ char32_t __value = static_cast<unsigned char>(*__first_++) & 0x07;
+ __value <<= 6;
+ __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
+ __value <<= 6;
+ __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
+ __value <<= 6;
+ __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
+ return __value;
+ }
+ }
+ // An invalid number of leading ones can be garbage or a code unit in the
+ // middle of a code point. By consuming one code unit the parser may get
+ // "in sync" after a few code units.
+ ++__first_;
+ return __replacement_character;
+ }
+
+private:
+ const char* __first_;
+ const char* __last_;
+};
+
+# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+/// This specialization depends on the size of wchar_t
+/// - 2 UTF-16 (for example Windows and AIX)
+/// - 4 UTF-32 (for example Linux)
+template <>
+class __code_point_view<wchar_t> {
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const wchar_t* __first, const wchar_t* __last)
+ : __first_(__first), __last_(__last) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const wchar_t* __position() const noexcept { return __first_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr char32_t __consume() noexcept {
+ _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input");
+
+ if constexpr (sizeof(wchar_t) == 2) {
+ char32_t __result = *__first_++;
+ // Is the code unit part of a surrogate pair? See
+ // https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF
+ if (__result >= 0xd800 && __result <= 0xDfff) {
+ // Malformed Unicode.
+ if (__first_ == __last_) [[unlikely]]
+ return __replacement_character;
+
+ __result -= 0xd800;
+ __result <<= 10;
+ __result += *__first_++ - 0xdc00;
+ __result += 0x10000;
+ }
+ return __result;
+
+ } else if constexpr (sizeof(wchar_t) == 4) {
+ char32_t __result = *__first_++;
+ if (__result > 0x10FFFF) [[unlikely]]
+ return __replacement_character;
+ return __result;
+ } else {
+ // TODO FMT P2593R0 Use static_assert(false, "sizeof(wchar_t) has a not implemented value");
+ _LIBCPP_ASSERT(sizeof(wchar_t) == 0, "sizeof(wchar_t) has a not implemented value");
+ __libcpp_unreachable();
+ }
+ }
+
+private:
+ const wchar_t* __first_;
+ const wchar_t* __last_;
+};
+# endif
+
+_LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
+ bool& __ri_break_allowed,
+ bool __has_extened_pictographic,
+ __extended_grapheme_custer_property_boundary::__property __prev,
+ __extended_grapheme_custer_property_boundary::__property __next) {
+ using __extended_grapheme_custer_property_boundary::__property;
+
+ __has_extened_pictographic |= __prev == __property::__Extended_Pictographic;
+
+ // https://www.unicode.org/reports/tr29/tr29-39.html#Grapheme_Cluster_Boundary_Rules
+
+ // *** Break at the start and end of text, unless the text is empty. ***
+
+ _LIBCPP_ASSERT(__prev != __property::__sot, "should be handled in the constructor"); // GB1
+ _LIBCPP_ASSERT(__prev != __property::__eot, "should be handled by our caller"); // GB2
+
+ // *** Do not break between a CR and LF. Otherwise, break before and after controls. ***
+ if (__prev == __property::__CR && __next == __property::__LF) // GB3
+ return false;
+
+ if (__prev == __property::__Control || __prev == __property::__CR || __prev == __property::__LF) // GB4
+ return true;
+
+ if (__next == __property::__Control || __next == __property::__CR || __next == __property::__LF) // GB5
+ return true;
+
+ // *** Do not break Hangul syllable sequences. ***
+ if (__prev == __property::__L &&
+ (__next == __property::__L || __next == __property::__V || __next == __property::__LV ||
+ __next == __property::__LVT)) // GB6
+ return false;
+
+ if ((__prev == __property::__LV || __prev == __property::__V) &&
+ (__next == __property::__V || __next == __property::__T)) // GB7
+ return false;
+
+ if ((__prev == __property::__LVT || __prev == __property::__T) && __next == __property::__T) // GB8
+ return false;
+
+ // *** Do not break before extending characters or ZWJ. ***
+ if (__next == __property::__Extend || __next == __property::__ZWJ)
+ return false; // GB9
+
+ // *** Do not break before SpacingMarks, or after Prepend characters. ***
+ if (__next == __property::__SpacingMark) // GB9a
+ return false;
+
+ if (__prev == __property::__Prepend) // GB9b
+ return false;
+
+ // *** Do not break within emoji modifier sequences or emoji zwj sequences. ***
+
+ // GB11 \p{Extended_Pictographic} Extend* ZWJ x \p{Extended_Pictographic}
+ //
+ // Note that several parts of this rule are matched by GB9: Any x (Extend | ZWJ)
+ // - \p{Extended_Pictographic} x Extend
+ // - Extend x Extend
+ // - \p{Extended_Pictographic} x ZWJ
+ // - Extend x ZWJ
+ //
+ // So the only case left to test is
+ // - \p{Extended_Pictographic}' x ZWJ x \p{Extended_Pictographic}
+ // where \p{Extended_Pictographic}' is stored in __has_extened_pictographic
+ if (__has_extened_pictographic && __prev == __property::__ZWJ && __next == __property::__Extended_Pictographic)
+ return false;
+
+ // *** Do not break within emoji flag sequences ***
+
+ // That is, do not break between regional indicator (RI) symbols if there
+ // is an odd number of RI characters before the break point.
+
+ if (__prev == __property::__Regional_Indicator && __next == __property::__Regional_Indicator) { // GB12 + GB13
+ __ri_break_allowed = !__ri_break_allowed;
+ if (__ri_break_allowed)
+ return true;
+
+ return false;
+ }
+
+ // *** Otherwise, break everywhere. ***
+ return true; // GB999
+}
+
+/// Helper class to extract an extended grapheme cluster from a Unicode character range.
+///
+/// This function is used to determine the column width of an extended grapheme
+/// cluster. In order to do that only the first code point is evaluated.
+/// Therefore only this code point is extracted.
+template <class _CharT>
+class __extended_grapheme_cluster_view {
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __extended_grapheme_cluster_view(const _CharT* __first, const _CharT* __last)
+ : __code_point_view_(__first, __last),
+ __next_code_point_(__code_point_view_.__consume()),
+ __next_prop_(__extended_grapheme_custer_property_boundary::__get_property(__next_code_point_)) {}
+
+ struct __cluster {
+ /// The first code point of the extended grapheme cluster.
+ ///
+ /// The first code point is used to estimate the width of the extended
+ /// grapheme cluster.
+ char32_t __code_point_;
+
+ /// Points one beyond the last code unit in the extended grapheme cluster.
+ ///
+ /// It's expected the caller has the start position and thus can determine
+ /// the code unit range of the extended grapheme cluster.
+ const _CharT* __last_;
+ };
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() {
+ _LIBCPP_ASSERT(
+ __next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot,
+ "can't move beyond the end of input");
+ char32_t __code_point = __next_code_point_;
+ if (!__code_point_view_.__at_end())
+ return {__code_point, __get_break()};
+
+ __next_prop_ = __extended_grapheme_custer_property_boundary::__property::__eot;
+ return {__code_point, __code_point_view_.__position()};
+ }
+
+private:
+ __code_point_view<_CharT> __code_point_view_;
+
+ char32_t __next_code_point_;
+ __extended_grapheme_custer_property_boundary::__property __next_prop_;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __get_break() {
+ bool __ri_break_allowed = true;
+ bool __has_extened_pictographic = false;
+ while (true) {
+ const _CharT* __result = __code_point_view_.__position();
+ __extended_grapheme_custer_property_boundary::__property __prev = __next_prop_;
+ if (__code_point_view_.__at_end()) {
+ __next_prop_ = __extended_grapheme_custer_property_boundary::__property::__eot;
+ return __result;
+ }
+ __next_code_point_ = __code_point_view_.__consume();
+ __next_prop_ = __extended_grapheme_custer_property_boundary::__get_property(__next_code_point_);
+
+ __has_extened_pictographic |=
+ __prev == __extended_grapheme_custer_property_boundary::__property::__Extended_Pictographic;
+
+ if (__at_extended_grapheme_cluster_break(__ri_break_allowed, __has_extened_pictographic, __prev, __next_prop_))
+ return __result;
+ }
+ }
+};
+
+} // namespace __unicode
+
+# endif // _LIBCPP_HAS_NO_UNICODE
+
+#endif //_LIBCPP_STD_VER > 17
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FORMAT_UNICODE_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h b/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h
index 05fb23d7c3..8e37082b6b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h
@@ -12,6 +12,7 @@
#include <__algorithm/search.h>
#include <__config>
+#include <__functional/identity.h>
#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <__utility/pair.h>
@@ -38,16 +39,15 @@ public:
pair<_ForwardIterator2, _ForwardIterator2>
operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
{
- return _VSTD::__search(__f, __l, __first_, __last_, __pred_,
- typename iterator_traits<_ForwardIterator>::iterator_category(),
- typename iterator_traits<_ForwardIterator2>::iterator_category());
+ auto __proj = __identity();
+ return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
}
private:
_ForwardIterator __first_;
_ForwardIterator __last_;
_BinaryPredicate __pred_;
- };
+};
#endif // _LIBCPP_STD_VER > 14
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h
index 1fbdc955d1..63525e230a 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h
@@ -481,6 +481,12 @@ struct __is_exactly_cpp17_forward_iterator
__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value &&
!__has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value> {};
+template <class _Tp>
+struct __is_exactly_cpp17_bidirectional_iterator
+ : public integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, random_access_iterator_tag>::value> {};
+
template<class _InputIterator>
using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h
index a915609dbe..7f4ef3c3d5 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h
@@ -332,41 +332,16 @@ using _ReverseWrapper = reverse_iterator<reverse_iterator<_Iter> >;
template <class _Iter, bool __b>
struct __unwrap_iter_impl<_ReverseWrapper<_Iter>, __b> {
- static _LIBCPP_CONSTEXPR decltype(std::__unwrap_iter(std::declval<_Iter>()))
- __apply(_ReverseWrapper<_Iter> __i) _NOEXCEPT {
- return std::__unwrap_iter(__i.base().base());
- }
-};
-
-template <class _OrigIter, class _UnwrappedIter>
-struct __rewrap_iter_impl<_ReverseWrapper<_OrigIter>, _UnwrappedIter> {
- template <class _Iter>
- struct _ReverseWrapperCount {
- static _LIBCPP_CONSTEXPR const size_t value = 1;
- };
-
- template <class _Iter>
- struct _ReverseWrapperCount<_ReverseWrapper<_Iter> > {
- static _LIBCPP_CONSTEXPR const size_t value = 1 + _ReverseWrapperCount<_Iter>::value;
- };
-
- template <size_t _RewrapCount, class _OIter, class _UIter, __enable_if_t<_RewrapCount != 0, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _ReverseWrapper<_OIter> __rewrap(_ReverseWrapper<_OIter> __iter1,
- _UIter __iter2) {
- return _ReverseWrapper<_OIter>(
- reverse_iterator<_OIter>(__rewrap<_RewrapCount - 1>(__iter1.base().base(), __iter2)));
- }
+ using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
- template <size_t _RewrapCount, class _OIter, class _UIter, __enable_if_t<_RewrapCount == 0, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR decltype(std::__rewrap_iter(std::declval<_OIter>(),
- std::declval<_UIter>()))
- __rewrap(_OIter __iter1, _UIter __iter2) {
- return std::__rewrap_iter(__iter1, __iter2);
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ReverseWrapper<_Iter>
+ __rewrap(_ReverseWrapper<_Iter> __orig_iter, _UnwrappedIter __unwrapped_iter) {
+ return _ReverseWrapper<_Iter>(
+ reverse_iterator<_Iter>(__unwrap_iter_impl<_Iter>::__rewrap(__orig_iter.base().base(), __unwrapped_iter)));
}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _ReverseWrapper<_OrigIter> __apply(_ReverseWrapper<_OrigIter> __iter1,
- _UnwrappedIter __iter2) {
- return __rewrap<_ReverseWrapperCount<_OrigIter>::value>(__iter1, __iter2);
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _UnwrappedIter __unwrap(_ReverseWrapper<_Iter> __i) _NOEXCEPT {
+ return __unwrap_iter_impl<_Iter>::__unwrap(__i.base().base());
}
};
diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale b/contrib/libs/cxxsupp/libcxx/include/__locale
index 41a53188d6..3aa8e7505c 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__locale
+++ b/contrib/libs/cxxsupp/libcxx/include/__locale
@@ -34,7 +34,7 @@
# include <__support/newlib/xlocale.h>
#elif defined(__OpenBSD__)
# include <__support/openbsd/xlocale.h>
-#elif (defined(__APPLE__) || defined(__FreeBSD__) || defined(__IBMCPP__))
+#elif (defined(__APPLE__) || defined(__FreeBSD__))
# include <xlocale.h>
#elif defined(__Fuchsia__)
# include <__support/fuchsia/xlocale.h>
@@ -490,7 +490,11 @@ public:
static const mask punct = _ISPUNCT;
static const mask xdigit = _ISXDIGIT;
static const mask blank = _ISBLANK;
+# if defined(_AIX)
+ static const mask __regex_word = 0x8000;
+# else
static const mask __regex_word = 0x80;
+# endif
#elif defined(_NEWLIB_VERSION)
// Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
typedef char mask;
@@ -543,11 +547,8 @@ public:
_LIBCPP_INLINE_VISIBILITY ctype_base() {}
-// TODO: Remove the ifndef when the assert no longer fails on AIX.
-#ifndef _AIX
static_assert((__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank)) == __regex_word,
"__regex_word can't overlap other bits");
-#endif
};
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h
index 9ec7f9a0e6..aa2b936341 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h
@@ -802,9 +802,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
__pos += __n;
else
__pos = __sz;
- const _CharT* __r = _VSTD::__find_end(
- __p, __p + __pos, __s, __s + __n, _Traits::eq,
- random_access_iterator_tag(), random_access_iterator_tag());
+ const _CharT* __r = std::__find_end_classic(__p, __p + __pos, __s, __s + __n, _Traits::eq);
if (__n > 0 && __r == __p + __pos)
return __npos;
return static_cast<_SizeT>(__r - __p);
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h b/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
index 535bad7856..c41e26420f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
@@ -46,18 +46,18 @@ extern "C" {
extern "C" {
#endif
-inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char* __nptr, char** __endptr,
- locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI float
+strtof_l(const char* __nptr, char** __endptr, locale_t) {
return ::strtof(__nptr, __endptr);
}
-inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char* __nptr,
- char** __endptr, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI double
+strtod_l(const char* __nptr, char** __endptr, locale_t) {
return ::strtod(__nptr, __endptr);
}
-inline _LIBCPP_INLINE_VISIBILITY long strtol_l(const char* __nptr, char** __endptr,
- int __base, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI long
+strtol_l(const char* __nptr, char** __endptr, int __base, locale_t) {
return ::strtol(__nptr, __endptr, __base);
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h
deleted file mode 100644
index 45f1f1e368..0000000000
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
-#define _LIBCPP_SUPPORT_IBM_LIMITS_H
-
-#if !defined(_AIX) // Linux
-#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
-
-static const unsigned int _QNAN_F = 0x7fc00000;
-#define NANF (*((float *)(&_QNAN_F)))
-static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
-#define NANL (*((long double *)(&_QNAN_LDBL128)))
-static const unsigned int _SNAN_F= 0x7f855555;
-#define NANSF (*((float *)(&_SNAN_F)))
-static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
-#define NANS (*((double *)(&_SNAN_D)))
-static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
-#define NANSL (*((long double *)(&_SNAN_LDBL128)))
-
-#define __builtin_huge_val() HUGE_VAL
-#define __builtin_huge_valf() HUGE_VALF
-#define __builtin_huge_vall() HUGE_VALL
-#define __builtin_nan(__dummy) NAN
-#define __builtin_nanf(__dummy) NANF
-#define __builtin_nanl(__dummy) NANL
-#define __builtin_nans(__dummy) NANS
-#define __builtin_nansf(__dummy) NANSF
-#define __builtin_nansl(__dummy) NANSL
-
-#else
-
-#include <math.h>
-#include <float.h> // limit constants
-
-#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
-#define __builtin_huge_valf() HUGE_VALF //0x7f800000
-#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
-#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
-#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
-#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
-#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
-#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
-#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
-
-#define __FLT_MANT_DIG__ FLT_MANT_DIG
-#define __FLT_DIG__ FLT_DIG
-#define __FLT_RADIX__ FLT_RADIX
-#define __FLT_MIN_EXP__ FLT_MIN_EXP
-#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
-#define __FLT_MAX_EXP__ FLT_MAX_EXP
-#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
-#define __FLT_MIN__ FLT_MIN
-#define __FLT_MAX__ FLT_MAX
-#define __FLT_EPSILON__ FLT_EPSILON
-// predefined by XLC on LoP
-#define __FLT_DENORM_MIN__ 1.40129846e-45F
-
-#define __DBL_MANT_DIG__ DBL_MANT_DIG
-#define __DBL_DIG__ DBL_DIG
-#define __DBL_MIN_EXP__ DBL_MIN_EXP
-#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
-#define __DBL_MAX_EXP__ DBL_MAX_EXP
-#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
-#define __DBL_MIN__ DBL_MIN
-#define __DBL_MAX__ DBL_MAX
-#define __DBL_EPSILON__ DBL_EPSILON
-// predefined by XLC on LoP
-#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
-
-#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
-#define __LDBL_DIG__ LDBL_DIG
-#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
-#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
-#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
-#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
-#define __LDBL_MIN__ LDBL_MIN
-#define __LDBL_MAX__ LDBL_MAX
-#define __LDBL_EPSILON__ LDBL_EPSILON
-// predefined by XLC on LoP
-#if __LONGDOUBLE128
-#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
-#else
-#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
-#endif
-
-// predefined by XLC on LoP
-#define __CHAR_BIT__ 8
-
-#endif // _AIX
-
-#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h
deleted file mode 100644
index a7751b0176..0000000000
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H
-#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
-
-extern "builtin" int __popcnt4(unsigned int);
-extern "builtin" int __popcnt8(unsigned long long);
-extern "builtin" unsigned int __cnttz4(unsigned int);
-extern "builtin" unsigned int __cnttz8(unsigned long long);
-extern "builtin" unsigned int __cntlz4(unsigned int);
-extern "builtin" unsigned int __cntlz8(unsigned long long);
-
-// Builtin functions for counting population
-#define __builtin_popcount(x) __popcnt4(x)
-#define __builtin_popcountll(x) __popcnt8(x)
-#if defined(__64BIT__)
-#define __builtin_popcountl(x) __builtin_popcountll(x)
-#else
-#define __builtin_popcountl(x) __builtin_popcount(x)
-#endif
-
-// Builtin functions for counting trailing zeros
-#define __builtin_ctz(x) __cnttz4(x)
-#define __builtin_ctzll(x) __cnttz8(x)
-#if defined(__64BIT__)
-#define __builtin_ctzl(x) __builtin_ctzll(x)
-#else
-#define __builtin_ctzl(x) __builtin_ctz(x)
-#endif
-
-// Builtin functions for counting leading zeros
-#define __builtin_clz(x) __cntlz4(x)
-#define __builtin_clzll(x) __cntlz8(x)
-#if defined(__64BIT__)
-#define __builtin_clzl(x) __builtin_clzll(x)
-#else
-#define __builtin_clzl(x) __builtin_clz(x)
-#endif
-
-#if defined(__64BIT__)
-#define __SIZE_WIDTH__ 64
-#else
-#define __SIZE_WIDTH__ 32
-#endif
-
-#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
index 11c1847e4c..5a09212c6a 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
@@ -10,7 +10,10 @@
#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
+#if defined(__MVS__)
#include <__support/ibm/locale_mgmt_zos.h>
+#endif // defined(__MVS__)
+
#include <stdarg.h>
#include "cstdlib"
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h
index e2b1f62f57..294149eb8f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h
@@ -19,141 +19,141 @@
extern "C" {
#endif
-inline _LIBCPP_INLINE_VISIBILITY int isalnum_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isalnum_l(int __c, locale_t) {
return ::isalnum(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isalpha_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isalpha_l(int __c, locale_t) {
return ::isalpha(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isblank_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isblank_l(int __c, locale_t) {
return ::isblank(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iscntrl_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iscntrl_l(int __c, locale_t) {
return ::iscntrl(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isdigit_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isdigit_l(int __c, locale_t) {
return ::isdigit(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isgraph_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isgraph_l(int __c, locale_t) {
return ::isgraph(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int islower_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int islower_l(int __c, locale_t) {
return ::islower(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isprint_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isprint_l(int __c, locale_t) {
return ::isprint(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int ispunct_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int ispunct_l(int __c, locale_t) {
return ::ispunct(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isspace_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isspace_l(int __c, locale_t) {
return ::isspace(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isupper_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isupper_l(int __c, locale_t) {
return ::isupper(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int isxdigit_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int isxdigit_l(int __c, locale_t) {
return ::isxdigit(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswalnum_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswalnum_l(wint_t __c, locale_t) {
return ::iswalnum(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswalpha_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswalpha_l(wint_t __c, locale_t) {
return ::iswalpha(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswblank_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswblank_l(wint_t __c, locale_t) {
return ::iswblank(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswcntrl_l(wint_t __c, locale_t) {
return ::iswcntrl(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswdigit_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswdigit_l(wint_t __c, locale_t) {
return ::iswdigit(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswgraph_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswgraph_l(wint_t __c, locale_t) {
return ::iswgraph(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswlower_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswlower_l(wint_t __c, locale_t) {
return ::iswlower(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswprint_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswprint_l(wint_t __c, locale_t) {
return ::iswprint(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswpunct_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswpunct_l(wint_t __c, locale_t) {
return ::iswpunct(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswspace_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswspace_l(wint_t __c, locale_t) {
return ::iswspace(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswupper_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswupper_l(wint_t __c, locale_t) {
return ::iswupper(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int iswxdigit_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int iswxdigit_l(wint_t __c, locale_t) {
return ::iswxdigit(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int toupper_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int toupper_l(int __c, locale_t) {
return ::toupper(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int tolower_l(int __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int tolower_l(int __c, locale_t) {
return ::tolower(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY wint_t towupper_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI wint_t towupper_l(wint_t __c, locale_t) {
return ::towupper(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY wint_t towlower_l(wint_t __c, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI wint_t towlower_l(wint_t __c, locale_t) {
return ::towlower(__c);
}
-inline _LIBCPP_INLINE_VISIBILITY int strcoll_l(const char *__s1, const char *__s2,
- locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int
+strcoll_l(const char *__s1, const char *__s2, locale_t) {
return ::strcoll(__s1, __s2);
}
-inline _LIBCPP_INLINE_VISIBILITY size_t strxfrm_l(char *__dest, const char *__src,
- size_t __n, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI size_t
+strxfrm_l(char *__dest, const char *__src, size_t __n, locale_t) {
return ::strxfrm(__dest, __src, __n);
}
-inline _LIBCPP_INLINE_VISIBILITY size_t strftime_l(char *__s, size_t __max,
- const char *__format,
- const struct tm *__tm, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI size_t
+strftime_l(char *__s, size_t __max, const char *__format, const struct tm *__tm,
+ locale_t) {
return ::strftime(__s, __max, __format, __tm);
}
-inline _LIBCPP_INLINE_VISIBILITY int wcscoll_l(const wchar_t *__ws1,
- const wchar_t *__ws2, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI int
+wcscoll_l(const wchar_t *__ws1, const wchar_t *__ws2, locale_t) {
return ::wcscoll(__ws1, __ws2);
}
-inline _LIBCPP_INLINE_VISIBILITY size_t wcsxfrm_l(wchar_t *__dest, const wchar_t *__src,
- size_t __n, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI size_t
+wcsxfrm_l(wchar_t *__dest, const wchar_t *__src, size_t __n, locale_t) {
return ::wcsxfrm(__dest, __src, __n);
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h
index 497148a662..19780909b2 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h
@@ -19,43 +19,43 @@
extern "C" {
#endif
-inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char *__nptr,
- char **__endptr, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI float
+strtof_l(const char *__nptr, char **__endptr, locale_t) {
return ::strtof(__nptr, __endptr);
}
-inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char *__nptr,
- char **__endptr, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI double
+strtod_l(const char *__nptr, char **__endptr, locale_t) {
return ::strtod(__nptr, __endptr);
}
-inline _LIBCPP_INLINE_VISIBILITY long double strtold_l(const char *__nptr,
- char **__endptr, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI long double
+strtold_l(const char *__nptr, char **__endptr, locale_t) {
return ::strtold(__nptr, __endptr);
}
-inline _LIBCPP_INLINE_VISIBILITY long long
+inline _LIBCPP_HIDE_FROM_ABI long long
strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t) {
return ::strtoll(__nptr, __endptr, __base);
}
-inline _LIBCPP_INLINE_VISIBILITY unsigned long long
+inline _LIBCPP_HIDE_FROM_ABI unsigned long long
strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t) {
return ::strtoull(__nptr, __endptr, __base);
}
-inline _LIBCPP_INLINE_VISIBILITY long long
+inline _LIBCPP_HIDE_FROM_ABI long long
wcstoll_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) {
return ::wcstoll(__nptr, __endptr, __base);
}
-inline _LIBCPP_INLINE_VISIBILITY unsigned long long
+inline _LIBCPP_HIDE_FROM_ABI unsigned long long
wcstoull_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) {
return ::wcstoull(__nptr, __endptr, __base);
}
-inline _LIBCPP_INLINE_VISIBILITY long double wcstold_l(const wchar_t *__nptr,
- wchar_t **__endptr, locale_t) {
+inline _LIBCPP_HIDE_FROM_ABI long double
+wcstold_l(const wchar_t *__nptr, wchar_t **__endptr, locale_t) {
return ::wcstold(__nptr, __endptr);
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm
index 67741e30d8..e972a34d06 100644
--- a/contrib/libs/cxxsupp/libcxx/include/algorithm
+++ b/contrib/libs/cxxsupp/libcxx/include/algorithm
@@ -360,6 +360,17 @@ namespace ranges {
borrowed_iterator_t<R>
ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
+ class Proj = identity>
+ requires sortable<I, Comp, Proj>
+ constexpr I
+ ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
+
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
+ requires sortable<iterator_t<R>, Comp, Proj>
+ constexpr borrowed_iterator_t<R>
+ ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
+
template<class T, output_iterator<const T&> O, sentinel_for<O> S>
constexpr O ranges::fill(O first, S last, const T& value); // since C++20
@@ -464,6 +475,28 @@ namespace ranges {
ranges::less>
constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Proj proj = {}); // since C++20
+
+ template<permutable I, sentinel_for<I> S, class Proj = identity,
+ indirect_unary_predicate<projected<I, Proj>> Pred>
+ constexpr subrange<I>
+ partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20
+
+ template<forward_range R, class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ requires permutable<iterator_t<R>>
+ constexpr borrowed_subrange_t<R>
+ partition(R&& r, Pred pred, Proj proj = {}); // Since C++20
+
+ template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
+ indirect_unary_predicate<projected<I, Proj>> Pred>
+ requires permutable<I>
+ subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20
+
+ template<bidirectional_range R, class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ requires permutable<iterator_t<R>>
+ borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // Since C++20
+
template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
@@ -548,6 +581,34 @@ namespace ranges {
constexpr ranges::move_result<borrowed_iterator_t<R>, O>
ranges::move(R&& r, O result); // since C++20
+ template<class I, class O1, class O2>
+ using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
+
+ template<input_iterator I, sentinel_for<I> S,
+ weakly_incrementable O1, weakly_incrementable O2,
+ class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
+ requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
+ constexpr partition_copy_result<I, O1, O2>
+ partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
+ Proj proj = {}); // Since C++20
+
+ template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
+ class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ requires indirectly_copyable<iterator_t<R>, O1> &&
+ indirectly_copyable<iterator_t<R>, O2>
+ constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
+ partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20
+
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
+ indirect_unary_predicate<projected<I, Proj>> Pred>
+ constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20
+
+ template<forward_range R, class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ constexpr borrowed_iterator_t<R>
+ partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20
+
template<class I1, class I2, class O>
using merge_result = in_in_out_result<I1, I2, O>; // since C++20
@@ -649,6 +710,86 @@ namespace ranges {
constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
+ template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
+ sentinel_for<I2> S2, class Pred = ranges::equal_to,
+ class Proj1 = identity, class Proj2 = identity>
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
+ constexpr subrange<I1>
+ ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
+ class Proj1 = identity, class Proj2 = identity>
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
+ constexpr borrowed_subrange_t<R1>
+ ranges::search(R1&& r1, R2&& r2, Pred pred = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<forward_iterator I, sentinel_for<I> S, class T,
+ class Pred = ranges::equal_to, class Proj = identity>
+ requires indirectly_comparable<I, const T*, Pred, Proj>
+ constexpr subrange<I>
+ ranges::search_n(I first, S last, iter_difference_t<I> count,
+ const T& value, Pred pred = {}, Proj proj = {}); // since C++20
+
+ template<forward_range R, class T, class Pred = ranges::equal_to,
+ class Proj = identity>
+ requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
+ constexpr borrowed_subrange_t<R>
+ ranges::search_n(R&& r, range_difference_t<R> count,
+ const T& value, Pred pred = {}, Proj proj = {}); // since C++20
+
+ template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
+ constexpr subrange<I1>
+ ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<forward_range R1, forward_range R2,
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
+ constexpr borrowed_subrange_t<R1>
+ ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<class I1, class I2, class O>
+ using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
+
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
+ weakly_incrementable O, class Comp = ranges::less,
+ class Proj1 = identity, class Proj2 = identity>
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
+ constexpr set_symmetric_difference_result<I1, I2, O>
+ set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
+ Comp comp = {}, Proj1 proj1 = {},
+ Proj2 proj2 = {}); // since C++20
+
+ template<input_range R1, input_range R2, weakly_incrementable O,
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
+ constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
+ borrowed_iterator_t<R2>, O>
+ set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<class I1, class I2, class O>
+ using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
+
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
+ weakly_incrementable O, class Comp = ranges::less,
+ class Proj1 = identity, class Proj2 = identity>
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
+ constexpr set_union_result<I1, I2, O>
+ set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<input_range R1, input_range R2, weakly_incrementable O,
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
+ constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
+ set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
}
constexpr bool // constexpr in C++20
@@ -1392,6 +1533,7 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_fill.h>
#include <__algorithm/ranges_fill_n.h>
#include <__algorithm/ranges_find.h>
+#include <__algorithm/ranges_find_end.h>
#include <__algorithm/ranges_find_first_of.h>
#include <__algorithm/ranges_find_if.h>
#include <__algorithm/ranges_find_if_not.h>
@@ -1415,6 +1557,10 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_move_backward.h>
#include <__algorithm/ranges_none_of.h>
#include <__algorithm/ranges_nth_element.h>
+#include <__algorithm/ranges_partial_sort.h>
+#include <__algorithm/ranges_partition.h>
+#include <__algorithm/ranges_partition_copy.h>
+#include <__algorithm/ranges_partition_point.h>
#include <__algorithm/ranges_pop_heap.h>
#include <__algorithm/ranges_push_heap.h>
#include <__algorithm/ranges_remove.h>
@@ -1424,10 +1570,15 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_reverse.h>
#include <__algorithm/ranges_reverse_copy.h>
#include <__algorithm/ranges_rotate_copy.h>
+#include <__algorithm/ranges_search.h>
+#include <__algorithm/ranges_search_n.h>
#include <__algorithm/ranges_set_difference.h>
#include <__algorithm/ranges_set_intersection.h>
+#include <__algorithm/ranges_set_symmetric_difference.h>
+#include <__algorithm/ranges_set_union.h>
#include <__algorithm/ranges_sort.h>
#include <__algorithm/ranges_sort_heap.h>
+#include <__algorithm/ranges_stable_partition.h>
#include <__algorithm/ranges_stable_sort.h>
#include <__algorithm/ranges_swap_ranges.h>
#include <__algorithm/ranges_transform.h>
diff --git a/contrib/libs/cxxsupp/libcxx/include/bit b/contrib/libs/cxxsupp/libcxx/include/bit
index fe1bcadc81..15bc13a504 100644
--- a/contrib/libs/cxxsupp/libcxx/include/bit
+++ b/contrib/libs/cxxsupp/libcxx/include/bit
@@ -75,9 +75,6 @@ namespace std {
# include <iosfwd>
#endif
-#if defined(__IBMCPP__)
-# include "__support/ibm/support.h"
-#endif
#if defined(_LIBCPP_COMPILER_MSVC)
# include <intrin.h>
#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/chrono b/contrib/libs/cxxsupp/libcxx/include/chrono
index 9185d74c09..2af5fbcc51 100644
--- a/contrib/libs/cxxsupp/libcxx/include/chrono
+++ b/contrib/libs/cxxsupp/libcxx/include/chrono
@@ -13,6 +13,8 @@
/*
chrono synopsis
+#include <compare> // C++20
+
namespace std
{
namespace chrono
@@ -325,11 +327,7 @@ struct last_spec;
class day;
constexpr bool operator==(const day& x, const day& y) noexcept;
-constexpr bool operator!=(const day& x, const day& y) noexcept;
-constexpr bool operator< (const day& x, const day& y) noexcept;
-constexpr bool operator> (const day& x, const day& y) noexcept;
-constexpr bool operator<=(const day& x, const day& y) noexcept;
-constexpr bool operator>=(const day& x, const day& y) noexcept;
+constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept;
constexpr day operator+(const day& x, const days& y) noexcept;
constexpr day operator+(const days& x, const day& y) noexcept;
constexpr day operator-(const day& x, const days& y) noexcept;
@@ -715,9 +713,11 @@ constexpr chrono::year operator ""y(unsigned lo
#include <__chrono/year_month_day.h>
#include <__chrono/year_month_weekday.h>
#include <__config>
-#include <compare>
#include <version>
+// standard-mandated includes
+#include <compare>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format
index dd7d08dbbe..d2ec8fc233 100644
--- a/contrib/libs/cxxsupp/libcxx/include/format
+++ b/contrib/libs/cxxsupp/libcxx/include/format
@@ -131,7 +131,7 @@ namespace std {
#include <__assert> // all public C++ headers provide the assertion handler
// Make sure all feature-test macros are available.
#include <version>
-// Enable the contents of the header only when libc++ was built with LIBCXX_ENABLE_INCOMPLETE_FEATURES.
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#include <__algorithm/clamp.h>
@@ -157,6 +157,7 @@ namespace std {
#include <__format/formatter_pointer.h>
#include <__format/formatter_string.h>
#include <__format/parser_std_format_spec.h>
+#include <__format/unicode.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/incrementable_traits.h>
#include <__variant/monostate.h>
@@ -376,6 +377,7 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end,
__format::__parse_number_result __r =
__format::__parse_arg_id(__begin, __end, __parse_ctx);
+ bool __parse = *__r.__ptr == _CharT(':');
switch (*__r.__ptr) {
case _CharT(':'):
// The arg-id has a format-specifier, advance the input to the format-spec.
@@ -395,7 +397,7 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end,
if (__type == __arg_t::__handle)
__ctx.__handle(__r.__value).__parse(__parse_ctx);
else
- __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type);
+ __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type);
} else
_VSTD::visit_format_arg(
[&](auto __arg) {
@@ -405,7 +407,8 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end,
__arg.format(__parse_ctx, __ctx);
else {
formatter<decltype(__arg), _CharT> __formatter;
- __parse_ctx.advance_to(__formatter.parse(__parse_ctx));
+ if (__parse)
+ __parse_ctx.advance_to(__formatter.parse(__parse_ctx));
__ctx.advance_to(__formatter.format(__arg, __ctx));
}
},
diff --git a/contrib/libs/cxxsupp/libcxx/include/limits b/contrib/libs/cxxsupp/libcxx/include/limits
index 35e4d85734..1fa3a8228f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/limits
+++ b/contrib/libs/cxxsupp/libcxx/include/limits
@@ -110,10 +110,6 @@ template<> class numeric_limits<cv long double>;
#include "__support/win32/limits_msvc_win32.h"
#endif // _LIBCPP_MSVCRT
-#if defined(__IBMCPP__)
-#include "__support/ibm/limits.h"
-#endif // __IBMCPP__
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/ostream b/contrib/libs/cxxsupp/libcxx/include/ostream
index 283774585b..b3b3e3e4fa 100644
--- a/contrib/libs/cxxsupp/libcxx/include/ostream
+++ b/contrib/libs/cxxsupp/libcxx/include/ostream
@@ -130,6 +130,35 @@ template <class charT, class traits>
template <class Stream, class T>
Stream&& operator<<(Stream&& os, const T& x);
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, wchar_t) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char8_t) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char16_t) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char32_t) = delete; // since C++20
+template<class traits>
+basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, char8_t) = delete; // since C++20
+template<class traits>
+basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, char16_t) = delete; // since C++20
+template<class traits>
+basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, char32_t) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const wchar_t*) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const char8_t*) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const char16_t*) = delete; // since C++20
+template<class traits>
+basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const char32_t*) = delete; // since C++20
+template<class traits>
+basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char8_t*) = delete; // since C++20
+template<class traits>
+basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char16_t*) = delete; // since C++20
+template<class traits>
+basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char32_t*) = delete; // since C++20
+
} // std
*/
@@ -225,9 +254,13 @@ public:
basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
+#if _LIBCPP_STD_VER > 14
+// LWG 2221 - nullptr. This is not backported to older standards modes.
+// See https://reviews.llvm.org/D127033 for more info on the rationale.
_LIBCPP_INLINE_VISIBILITY
basic_ostream& operator<<(nullptr_t)
{ return *this << "nullptr"; }
+#endif
// 27.7.2.7 Unformatted output:
basic_ostream& put(char_type __c);
@@ -1098,6 +1131,57 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
+#if 0
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const wchar_t*) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char16_t) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char32_t) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char16_t*) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete;
+
+#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char8_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char8_t*) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete;
+#endif
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char32_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char16_t*) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete;
+
+#endif // _LIBCPP_STD_VER > 17
+
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version
index ec27c5ed25..25441d2ab1 100644
--- a/contrib/libs/cxxsupp/libcxx/include/version
+++ b/contrib/libs/cxxsupp/libcxx/include/version
@@ -248,7 +248,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_enable_shared_from_this 201603L
// # define __cpp_lib_execution 201603L
# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)
-# define __cpp_lib_filesystem 201703L
+# define __cpp_lib_filesystem 201703L
# endif
# define __cpp_lib_gcd_lcm 201606L
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make
index fe93dae953..c72710f6c8 100644
--- a/contrib/libs/cxxsupp/libcxx/ya.make
+++ b/contrib/libs/cxxsupp/libcxx/ya.make
@@ -8,14 +8,15 @@ LICENSE(
BSD-2-Clause AND
BSL-1.0 AND
MIT AND
- NCSA
+ NCSA AND
+ Unicode
)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2022-07-12)
+VERSION(2022-07-22)
-ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/81c48436bbd29736f77a111fc207e28854939907.tar.gz)
+ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/1d057a6d43060eaf6c679e0593a43f99ecd70987.tar.gz)
ADDINCL(
GLOBAL contrib/libs/cxxsupp/libcxx/include
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h
deleted file mode 100644
index 4bf3237892..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h
+++ /dev/null
@@ -1,202 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___COROUTINE_COROUTINE_HANDLE_H
-#define _LIBCPP___COROUTINE_COROUTINE_HANDLE_H
-
-#include <__assert>
-#include <__config>
-#include <__functional/hash.h>
-#include <__memory/addressof.h>
-#include <compare>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// [coroutine.handle]
-template <class _Promise = void>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle;
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
-public:
- // [coroutine.handle.con], construct/reset
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI
- coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept {
- return __handle_ != nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool done() const {
- _LIBCPP_ASSERT(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI
- void resume() const {
- _LIBCPP_ASSERT(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void destroy() const {
- _LIBCPP_ASSERT(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
-
-private:
- bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
-
- void* __handle_ = nullptr;
-};
-
-// [coroutine.handle.compare]
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return __x.address() == __y.address();
-}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr strong_ordering operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return compare_three_way()(__x.address(), __y.address());
-}
-
-template <class _Promise>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
-public:
- // [coroutine.handle.con], construct/reset
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI
- static coroutine_handle from_promise(_Promise& __promise) {
- using _RawPromise = typename remove_cv<_Promise>::type;
- coroutine_handle __tmp;
- __tmp.__handle_ =
- __builtin_coro_promise(_VSTD::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.conv], conversion
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept {
- return __handle_ != nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool done() const {
- _LIBCPP_ASSERT(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI
- void resume() const {
- _LIBCPP_ASSERT(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void destroy() const {
- _LIBCPP_ASSERT(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
-
- // [coroutine.handle.promise], promise access
- _LIBCPP_HIDE_FROM_ABI
- _Promise& promise() const {
- return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
- }
-
-private:
- bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
- void* __handle_ = nullptr;
-};
-
-// [coroutine.handle.hash]
-template <class _Tp>
-struct hash<coroutine_handle<_Tp>> {
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept { return hash<void*>()(__v.address()); }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-#endif // _LIBCPP___COROUTINE_COROUTINE_HANDLE_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h
deleted file mode 100644
index 0a5229b459..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___COROUTINE_COROUTINE_TRAITS_H
-#define _LIBCPP___COROUTINE_COROUTINE_TRAITS_H
-
-#include <__config>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// [coroutine.traits]
-// [coroutine.traits.primary]
-// The header <coroutine> defined the primary template coroutine_traits such that
-// if ArgTypes is a parameter pack of types and if the qualified-id R::promise_type
-// is valid and denotes a type ([temp.deduct]), then coroutine_traits<R, ArgTypes...>
-// has the following publicly accessible memebr:
-//
-// using promise_type = typename R::promise_type;
-//
-// Otherwise, coroutine_traits<R, ArgTypes...> has no members.
-template <class _Tp, class = void>
-struct __coroutine_traits_sfinae {};
-
-template <class _Tp>
-struct __coroutine_traits_sfinae<
- _Tp, typename __void_t<typename _Tp::promise_type>::type>
-{
- using promise_type = typename _Tp::promise_type;
-};
-
-template <class _Ret, class... _Args>
-struct coroutine_traits
- : public __coroutine_traits_sfinae<_Ret>
-{
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-#endif // _LIBCPP___COROUTINE_COROUTINE_TRAITS_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h
deleted file mode 100644
index 7a2c672057..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H
-#define _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H
-
-#include <__config>
-#include <__coroutine/coroutine_handle.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
-
-// [coroutine.noop]
-// [coroutine.promise.noop]
-struct noop_coroutine_promise {};
-
-// [coroutine.handle.noop]
-template <>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise> {
-public:
- // [coroutine.handle.noop.conv], conversion
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.noop.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool done() const noexcept { return false; }
-
- // [coroutine.handle.noop.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void resume() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void destroy() const noexcept {}
-
- // [coroutine.handle.noop.promise], promise access
- _LIBCPP_HIDE_FROM_ABI
- noop_coroutine_promise& promise() const noexcept {
- return *static_cast<noop_coroutine_promise*>(
- __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
- }
-
- // [coroutine.handle.noop.address], address
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
-private:
- _LIBCPP_HIDE_FROM_ABI
- friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
-
-#if __has_builtin(__builtin_coro_noop)
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept {
- this->__handle_ = __builtin_coro_noop();
- }
-
- void* __handle_ = nullptr;
-
-#elif defined(_LIBCPP_COMPILER_GCC)
- // GCC doesn't implement __builtin_coro_noop().
- // Construct the coroutine frame manually instead.
- struct __noop_coroutine_frame_ty_ {
- static void __dummy_resume_destroy_func() { }
-
- void (*__resume_)() = __dummy_resume_destroy_func;
- void (*__destroy_)() = __dummy_resume_destroy_func;
- struct noop_coroutine_promise __promise_;
- };
-
- static __noop_coroutine_frame_ty_ __noop_coroutine_frame_;
-
- void* __handle_ = &__noop_coroutine_frame_;
-
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
-
-#endif // __has_builtin(__builtin_coro_noop)
-};
-
-using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
-
-#if defined(_LIBCPP_COMPILER_GCC)
-inline noop_coroutine_handle::__noop_coroutine_frame_ty_
- noop_coroutine_handle::__noop_coroutine_frame_{};
-#endif
-
-// [coroutine.noop.coroutine]
-inline _LIBCPP_HIDE_FROM_ABI
-noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
-
-#endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-#endif // _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h
deleted file mode 100644
index 31399ab29a..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h
+++ /dev/null
@@ -1,46 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H
-#define __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H
-
-#include <__config>
-#include <__coroutine/coroutine_handle.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// [coroutine.trivial.awaitables]
-struct suspend_never {
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool await_ready() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_resume() const noexcept {}
-};
-
-struct suspend_always {
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool await_ready() const noexcept { return false; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_resume() const noexcept {}
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)
-
-#endif // __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h
index 6ffb2ab806..79637f3fbf 100644
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h
+++ b/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h
@@ -401,10 +401,11 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits
};
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
-template<class _Tp>
+
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+template<class _Tp>
requires is_object_v<_Tp>
-#endif
struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
@@ -417,6 +418,30 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
#endif
};
+#else // !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+template <class _Tp, bool is_pointer_to_object>
+struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer
+{
+ typedef ptrdiff_t difference_type;
+ typedef typename remove_cv<_Tp>::type value_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ typedef random_access_iterator_tag iterator_category;
+#if _LIBCPP_STD_VER > 17
+ typedef contiguous_iterator_tag iterator_concept;
+#endif
+};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer<_Tp, false> {};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> : public __iterator_traits_pointer<_Tp, is_object_v<_Tp>> {};
+
+#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+
template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>
struct __has_iterator_category_convertible_to
: is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h
deleted file mode 100644
index 77396222d6..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_ALL_H
-#define _LIBCPP___RANGES_ALL_H
-
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__ranges/access.h>
-#include <__ranges/concepts.h>
-#include <__ranges/owning_view.h>
-#include <__ranges/range_adaptor.h>
-#include <__ranges/ref_view.h>
-#include <__utility/auto_cast.h>
-#include <__utility/declval.h>
-#include <__utility/forward.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges::views {
-
-namespace __all {
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Tp>
- requires ranges::view<decay_t<_Tp>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))
- {
- return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
- }
-
- template<class _Tp>
- requires (!ranges::view<decay_t<_Tp>>) &&
- requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)}))
- {
- return ranges::ref_view{std::forward<_Tp>(__t)};
- }
-
- template<class _Tp>
- requires (!ranges::view<decay_t<_Tp>> &&
- !requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
- requires (_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)}))
- {
- return ranges::owning_view{std::forward<_Tp>(__t)};
- }
- };
-} // namespace __all
-
-inline namespace __cpo {
- inline constexpr auto all = __all::__fn{};
-} // namespace __cpo
-
-template<ranges::viewable_range _Range>
-using all_t = decltype(views::all(declval<_Range>()));
-
-} // namespace ranges::views
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_ALL_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h
deleted file mode 100644
index 78911284bb..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_COMMON_VIEW_H
-#define _LIBCPP___RANGES_COMMON_VIEW_H
-
-#include <__config>
-#include <__iterator/common_iterator.h>
-#include <__iterator/iterator_traits.h>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/concepts.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/range_adaptor.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
-#include <concepts>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
-
-template<view _View>
- requires (!common_range<_View> && copyable<iterator_t<_View>>)
-class common_view : public view_interface<common_view<_View>> {
- _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI
- common_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit common_view(_View __v) : __base_(std::move(__v)) { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
- if constexpr (random_access_range<_View> && sized_range<_View>)
- return ranges::begin(__base_);
- else
- return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires range<const _View> {
- if constexpr (random_access_range<const _View> && sized_range<const _View>)
- return ranges::begin(__base_);
- else
- return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
- if constexpr (random_access_range<_View> && sized_range<_View>)
- return ranges::begin(__base_) + ranges::size(__base_);
- else
- return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires range<const _View> {
- if constexpr (random_access_range<const _View> && sized_range<const _View>)
- return ranges::begin(__base_) + ranges::size(__base_);
- else
- return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
- return ranges::size(__base_);
- }
-};
-
-template<class _Range>
-common_view(_Range&&)
- -> common_view<views::all_t<_Range>>;
-
-template<class _View>
-inline constexpr bool enable_borrowed_range<common_view<_View>> = enable_borrowed_range<_View>;
-
-namespace views {
-namespace __common {
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- requires common_range<_Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(views::all(std::forward<_Range>(__range))))
- -> decltype( views::all(std::forward<_Range>(__range)))
- { return views::all(std::forward<_Range>(__range)); }
-
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(common_view{std::forward<_Range>(__range)}))
- -> decltype( common_view{std::forward<_Range>(__range)})
- { return common_view{std::forward<_Range>(__range)}; }
- };
-} // namespace __common
-
-inline namespace __cpo {
- inline constexpr auto common = __common::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_COMMON_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h
deleted file mode 100644
index e1c08a7ea1..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___RANGES_COPYABLE_BOX_H
-#define _LIBCPP___RANGES_COPYABLE_BOX_H
-
-#include <__config>
-#include <__memory/addressof.h>
-#include <__memory/construct_at.h>
-#include <__utility/move.h>
-#include <concepts>
-#include <optional>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-// __copyable_box allows turning a type that is copy-constructible (but maybe not copy-assignable) into
-// a type that is both copy-constructible and copy-assignable. It does that by introducing an empty state
-// and basically doing destroy-then-copy-construct in the assignment operator. The empty state is necessary
-// to handle the case where the copy construction fails after destroying the object.
-//
-// In some cases, we can completely avoid the use of an empty state; we provide a specialization of
-// __copyable_box that does this, see below for the details.
-
-template<class _Tp>
-concept __copy_constructible_object = copy_constructible<_Tp> && is_object_v<_Tp>;
-
-namespace ranges {
- // Primary template - uses std::optional and introduces an empty state in case assignment fails.
- template<__copy_constructible_object _Tp>
- class __copyable_box {
- _LIBCPP_NO_UNIQUE_ADDRESS optional<_Tp> __val_;
-
- public:
- template<class ..._Args>
- requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __copyable_box(in_place_t, _Args&& ...__args)
- noexcept(is_nothrow_constructible_v<_Tp, _Args...>)
- : __val_(in_place, std::forward<_Args>(__args)...)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __copyable_box() noexcept(is_nothrow_default_constructible_v<_Tp>)
- requires default_initializable<_Tp>
- : __val_(in_place)
- { }
-
- _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box const&) = default;
- _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __copyable_box& operator=(__copyable_box const& __other)
- noexcept(is_nothrow_copy_constructible_v<_Tp>)
- {
- if (this != std::addressof(__other)) {
- if (__other.__has_value()) __val_.emplace(*__other);
- else __val_.reset();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __copyable_box& operator=(__copyable_box&&) requires movable<_Tp> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __copyable_box& operator=(__copyable_box&& __other)
- noexcept(is_nothrow_move_constructible_v<_Tp>)
- {
- if (this != std::addressof(__other)) {
- if (__other.__has_value()) __val_.emplace(std::move(*__other));
- else __val_.reset();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return *__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return *__val_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp *operator->() const noexcept { return __val_.operator->(); }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp *operator->() noexcept { return __val_.operator->(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return __val_.has_value(); }
- };
-
- // This partial specialization implements an optimization for when we know we don't need to store
- // an empty state to represent failure to perform an assignment. For copy-assignment, this happens:
- //
- // 1. If the type is copyable (which includes copy-assignment), we can use the type's own assignment operator
- // directly and avoid using std::optional.
- // 2. If the type is not copyable, but it is nothrow-copy-constructible, then we can implement assignment as
- // destroy-and-then-construct and we know it will never fail, so we don't need an empty state.
- //
- // The exact same reasoning can be applied for move-assignment, with copyable replaced by movable and
- // nothrow-copy-constructible replaced by nothrow-move-constructible. This specialization is enabled
- // whenever we can apply any of these optimizations for both the copy assignment and the move assignment
- // operator.
- template<class _Tp>
- concept __doesnt_need_empty_state_for_copy = copyable<_Tp> || is_nothrow_copy_constructible_v<_Tp>;
-
- template<class _Tp>
- concept __doesnt_need_empty_state_for_move = movable<_Tp> || is_nothrow_move_constructible_v<_Tp>;
-
- template<__copy_constructible_object _Tp>
- requires __doesnt_need_empty_state_for_copy<_Tp> && __doesnt_need_empty_state_for_move<_Tp>
- class __copyable_box<_Tp> {
- _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_;
-
- public:
- template<class ..._Args>
- requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __copyable_box(in_place_t, _Args&& ...__args)
- noexcept(is_nothrow_constructible_v<_Tp, _Args...>)
- : __val_(std::forward<_Args>(__args)...)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __copyable_box() noexcept(is_nothrow_default_constructible_v<_Tp>)
- requires default_initializable<_Tp>
- : __val_()
- { }
-
- _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box const&) = default;
- _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box&&) = default;
-
- // Implementation of assignment operators in case we perform optimization (1)
- _LIBCPP_HIDE_FROM_ABI __copyable_box& operator=(__copyable_box const&) requires copyable<_Tp> = default;
- _LIBCPP_HIDE_FROM_ABI __copyable_box& operator=(__copyable_box&&) requires movable<_Tp> = default;
-
- // Implementation of assignment operators in case we perform optimization (2)
- _LIBCPP_HIDE_FROM_ABI
- constexpr __copyable_box& operator=(__copyable_box const& __other) noexcept {
- static_assert(is_nothrow_copy_constructible_v<_Tp>);
- if (this != std::addressof(__other)) {
- std::destroy_at(std::addressof(__val_));
- std::construct_at(std::addressof(__val_), __other.__val_);
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __copyable_box& operator=(__copyable_box&& __other) noexcept {
- static_assert(is_nothrow_move_constructible_v<_Tp>);
- if (this != std::addressof(__other)) {
- std::destroy_at(std::addressof(__val_));
- std::construct_at(std::addressof(__val_), std::move(__other.__val_));
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __val_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp *operator->() const noexcept { return std::addressof(__val_); }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp *operator->() noexcept { return std::addressof(__val_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return true; }
- };
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_COPYABLE_BOX_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h
deleted file mode 100644
index 0a2d828578..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_COUNTED_H
-#define _LIBCPP___RANGES_COUNTED_H
-
-#include <__concepts/convertible_to.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/counted_iterator.h>
-#include <__iterator/default_sentinel.h>
-#include <__iterator/incrementable_traits.h>
-#include <__iterator/iterator_traits.h>
-#include <__memory/pointer_traits.h>
-#include <__ranges/subrange.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
-#include <span>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges::views {
-
-namespace __counted {
-
- struct __fn {
- template<contiguous_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
- // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
- { return span(std::to_address(__it), static_cast<size_t>(__count)); }
-
- template<random_access_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(subrange(__it, __it + __count)))
- -> decltype( subrange(__it, __it + __count))
- { return subrange(__it, __it + __count); }
-
- template<class _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel)))
- -> decltype( subrange(counted_iterator(std::move(__it), __count), default_sentinel))
- { return subrange(counted_iterator(std::move(__it), __count), default_sentinel); }
-
- template<class _It, convertible_to<iter_difference_t<_It>> _Diff>
- requires input_or_output_iterator<decay_t<_It>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_It&& __it, _Diff&& __count) const
- noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))))
- -> decltype( __go(std::forward<_It>(__it), std::forward<_Diff>(__count)))
- { return __go(std::forward<_It>(__it), std::forward<_Diff>(__count)); }
- };
-
-} // namespace __counted
-
-inline namespace __cpo {
- inline constexpr auto counted = __counted::__fn{};
-} // namespace __cpo
-
-} // namespace ranges::views
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_COUNTED_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h
deleted file mode 100644
index 079a74d4b8..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_DROP_VIEW_H
-#define _LIBCPP___RANGES_DROP_VIEW_H
-
-#include <__assert>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__iterator/next.h>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/concepts.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/non_propagating_cache.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__utility/move.h>
-#include <concepts>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<view _View>
- class drop_view
- : public view_interface<drop_view<_View>>
- {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method. If this is an input_range, then we cannot cache
- // begin because begin is not equality preserving.
- // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because
- // one can't call begin() on it more than once.
- static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>);
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- range_difference_t<_View> __count_ = 0;
- _View __base_ = _View();
-
-public:
- drop_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr drop_view(_View __base, range_difference_t<_View> __count)
- : __count_(__count)
- , __base_(std::move(__base))
- {
- _LIBCPP_ASSERT(__count_ >= 0, "count must be greater than or equal to zero.");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin()
- requires (!(__simple_view<_View> &&
- random_access_range<const _View> && sized_range<const _View>))
- {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires random_access_range<const _View> && sized_range<const _View>
- {
- return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end()
- requires (!__simple_view<_View>)
- { return ranges::end(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires range<const _View>
- { return ranges::end(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __size(auto& __self) {
- const auto __s = ranges::size(__self.__base_);
- const auto __c = static_cast<decltype(__s)>(__self.__count_);
- return __s < __c ? 0 : __s - __c;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
- requires sized_range<_View>
- { return __size(*this); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires sized_range<const _View>
- { return __size(*this); }
- };
-
- template<class _Range>
- drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>;
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_DROP_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h
deleted file mode 100644
index c0b55b221a..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_EMPTY_H
-#define _LIBCPP___RANGES_EMPTY_H
-
-#include <__concepts/class_or_enum.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__ranges/access.h>
-#include <__ranges/size.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-// [range.prim.empty]
-
-namespace ranges {
-namespace __empty {
- template <class _Tp>
- concept __member_empty =
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- bool(__t.empty());
- };
-
- template<class _Tp>
- concept __can_invoke_size =
- !__member_empty<_Tp> &&
- requires(_Tp&& __t) { ranges::size(__t); };
-
- template <class _Tp>
- concept __can_compare_begin_end =
- !__member_empty<_Tp> &&
- !__can_invoke_size<_Tp> &&
- requires(_Tp&& __t) {
- bool(ranges::begin(__t) == ranges::end(__t));
- { ranges::begin(__t) } -> forward_iterator;
- };
-
- struct __fn {
- template <__member_empty _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(__t.empty()))) {
- return bool(__t.empty());
- }
-
- template <__can_invoke_size _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::size(__t))) {
- return ranges::size(__t) == 0;
- }
-
- template<__can_compare_begin_end _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) {
- return ranges::begin(__t) == ranges::end(__t);
- }
- };
-} // namespace __empty
-
-inline namespace __cpo {
- inline constexpr auto empty = __empty::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_EMPTY_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h
deleted file mode 100644
index 6a08727678..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_EMPTY_VIEW_H
-#define _LIBCPP___RANGES_EMPTY_VIEW_H
-
-#include <__config>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/view_interface.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<class _Tp>
- requires is_object_v<_Tp>
- class empty_view : public view_interface<empty_view<_Tp>> {
- public:
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
- };
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_EMPTY_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h
deleted file mode 100644
index b7c099e049..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h
+++ /dev/null
@@ -1,408 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_IOTA_VIEW_H
-#define _LIBCPP___RANGES_IOTA_VIEW_H
-
-#include <__assert>
-#include <__compare/three_way_comparable.h>
-#include <__concepts/arithmetic.h>
-#include <__concepts/constructible.h>
-#include <__concepts/convertible_to.h>
-#include <__concepts/copyable.h>
-#include <__concepts/equality_comparable.h>
-#include <__concepts/invocable.h>
-#include <__concepts/same_as.h>
-#include <__concepts/semiregular.h>
-#include <__concepts/totally_ordered.h>
-#include <__config>
-#include <__functional/ranges_operations.h>
-#include <__iterator/concepts.h>
-#include <__iterator/incrementable_traits.h>
-#include <__iterator/iterator_traits.h>
-#include <__iterator/unreachable_sentinel.h>
-#include <__ranges/copyable_box.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/view_interface.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<class _Int>
- struct __get_wider_signed {
- static auto __call() {
- if constexpr (sizeof(_Int) < sizeof(short)) return type_identity<short>{};
- else if constexpr (sizeof(_Int) < sizeof(int)) return type_identity<int>{};
- else if constexpr (sizeof(_Int) < sizeof(long)) return type_identity<long>{};
- else return type_identity<long long>{};
-
- static_assert(sizeof(_Int) <= sizeof(long long),
- "Found integer-like type that is bigger than largest integer like type.");
- }
-
- using type = typename decltype(__call())::type;
- };
-
- template<class _Start>
- using _IotaDiffT = typename _If<
- (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)),
- type_identity<iter_difference_t<_Start>>,
- __get_wider_signed<_Start>
- >::type;
-
- template<class _Iter>
- concept __decrementable = incrementable<_Iter> && requires(_Iter __i) {
- { --__i } -> same_as<_Iter&>;
- { __i-- } -> same_as<_Iter>;
- };
-
- template<class _Iter>
- concept __advanceable =
- __decrementable<_Iter> && totally_ordered<_Iter> &&
- requires(_Iter __i, const _Iter __j, const _IotaDiffT<_Iter> __n) {
- { __i += __n } -> same_as<_Iter&>;
- { __i -= __n } -> same_as<_Iter&>;
- _Iter(__j + __n);
- _Iter(__n + __j);
- _Iter(__j - __n);
- { __j - __j } -> convertible_to<_IotaDiffT<_Iter>>;
- };
-
- template<class>
- struct __iota_iterator_category {};
-
- template<incrementable _Tp>
- struct __iota_iterator_category<_Tp> {
- using iterator_category = input_iterator_tag;
- };
-
- template<weakly_incrementable _Start, semiregular _Bound = unreachable_sentinel_t>
- requires __weakly_equality_comparable_with<_Start, _Bound> && copyable<_Start>
- class iota_view : public view_interface<iota_view<_Start, _Bound>> {
- struct __iterator : public __iota_iterator_category<_Start> {
- friend class iota_view;
-
- using iterator_concept =
- _If<__advanceable<_Start>, random_access_iterator_tag,
- _If<__decrementable<_Start>, bidirectional_iterator_tag,
- _If<incrementable<_Start>, forward_iterator_tag,
- /*Else*/ input_iterator_tag>>>;
-
- using value_type = _Start;
- using difference_type = _IotaDiffT<_Start>;
-
- _Start __value_ = _Start();
-
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<_Start> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
- return __value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- ++__value_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int) requires incrementable<_Start> {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--() requires __decrementable<_Start> {
- --__value_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int) requires __decrementable<_Start> {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ += static_cast<_Start>(__n);
- } else {
- __value_ -= static_cast<_Start>(-__n);
- }
- } else {
- __value_ += __n;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ -= static_cast<_Start>(__n);
- } else {
- __value_ += static_cast<_Start>(-__n);
- }
- } else {
- __value_ -= __n;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Start operator[](difference_type __n) const
- requires __advanceable<_Start>
- {
- return _Start(__value_ + __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<_Start>
- {
- return __x.__value_ == __y.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __x.__value_ < __y.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __y < __x;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__y < __x);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__x < __y);
- }
-
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start> && three_way_comparable<_Start>
- {
- return __x.__value_ <=> __y.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i += __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, __iterator __i)
- requires __advanceable<_Start>
- {
- return __i + __n;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i -= __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start>) {
- if constexpr (__signed_integer_like<_Start>) {
- return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_));
- }
- if (__y.__value_ > __x.__value_) {
- return difference_type(-difference_type(__y.__value_ - __x.__value_));
- }
- return difference_type(__x.__value_ - __y.__value_);
- }
- return __x.__value_ - __y.__value_;
- }
- };
-
- struct __sentinel {
- friend class iota_view;
-
- private:
- _Bound __bound_ = _Bound();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
- constexpr explicit __sentinel(_Bound __bound) : __bound_(std::move(__bound)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
- return __x.__value_ == __y.__bound_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y)
- requires sized_sentinel_for<_Bound, _Start>
- {
- return __x.__value_ - __y.__bound_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y)
- requires sized_sentinel_for<_Bound, _Start>
- {
- return -(__y - __x);
- }
- };
-
- _Start __value_ = _Start();
- _Bound __bound_ = _Bound();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- iota_view() requires default_initializable<_Start> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iota_view(type_identity_t<_Start> __value, type_identity_t<_Bound> __bound)
- : __value_(std::move(__value)), __bound_(std::move(__bound)) {
- // Validate the precondition if possible.
- if constexpr (totally_ordered_with<_Start, _Bound>) {
- _LIBCPP_ASSERT(ranges::less_equal()(__value_, __bound_),
- "Precondition violated: value is greater than bound.");
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iota_view(__iterator __first, __iterator __last)
- requires same_as<_Start, _Bound>
- : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iota_view(__iterator __first, _Bound __last)
- requires same_as<_Bound, unreachable_sentinel_t>
- : iota_view(std::move(__first.__value_), std::move(__last)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iota_view(__iterator __first, __sentinel __last)
- requires (!same_as<_Start, _Bound> && !same_as<_Start, unreachable_sentinel_t>)
- : iota_view(std::move(__first.__value_), std::move(__last.__bound_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator begin() const { return __iterator{__value_}; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const {
- if constexpr (same_as<_Bound, unreachable_sentinel_t>)
- return unreachable_sentinel;
- else
- return __sentinel{__bound_};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator end() const requires same_as<_Start, _Bound> {
- return __iterator{__bound_};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires (same_as<_Start, _Bound> && __advanceable<_Start>) ||
- (integral<_Start> && integral<_Bound>) ||
- sized_sentinel_for<_Bound, _Start>
- {
- if constexpr (__integer_like<_Start> && __integer_like<_Bound>) {
- if (__value_ < 0) {
- if (__bound_ < 0) {
- return std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_);
- }
- return std::__to_unsigned_like(__bound_) + std::__to_unsigned_like(-__value_);
- }
- return std::__to_unsigned_like(__bound_) - std::__to_unsigned_like(__value_);
- }
- return std::__to_unsigned_like(__bound_ - __value_);
- }
- };
-
- template<class _Start, class _Bound>
- requires (!__integer_like<_Start> || !__integer_like<_Bound> ||
- (__signed_integer_like<_Start> == __signed_integer_like<_Bound>))
- iota_view(_Start, _Bound) -> iota_view<_Start, _Bound>;
-
- template<class _Start, class _Bound>
- inline constexpr bool enable_borrowed_range<iota_view<_Start, _Bound>> = true;
-
-namespace views {
-namespace __iota {
- struct __fn {
- template<class _Start>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Start&& __start) const
- noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start)))
- { return ranges::iota_view(std::forward<_Start>(__start)); }
-
- template<class _Start, class _Bound>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Start&& __start, _Bound&& __bound) const
- noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)))
- { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)); }
- };
-} // namespace __iota
-
-inline namespace __cpo {
- inline constexpr auto iota = __iota::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_IOTA_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h
deleted file mode 100644
index 395e5c7ece..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h
+++ /dev/null
@@ -1,350 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_JOIN_VIEW_H
-#define _LIBCPP___RANGES_JOIN_VIEW_H
-
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/concepts.h>
-#include <__ranges/non_propagating_cache.h>
-#include <__ranges/ref_view.h>
-#include <__ranges/subrange.h>
-#include <__ranges/view_interface.h>
-#include <__utility/declval.h>
-#include <__utility/forward.h>
-#include <optional>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<class>
- struct __join_view_iterator_category {};
-
- template<class _View>
- requires is_reference_v<range_reference_t<_View>> &&
- forward_range<_View> &&
- forward_range<range_reference_t<_View>>
- struct __join_view_iterator_category<_View> {
- using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category;
-
- using iterator_category = _If<
- derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag>,
- bidirectional_iterator_tag,
- _If<
- derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>,
- forward_iterator_tag,
- input_iterator_tag
- >
- >;
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- class join_view
- : public view_interface<join_view<_View>> {
- private:
- using _InnerRange = range_reference_t<_View>;
-
- template<bool> struct __iterator;
- template<bool> struct __sentinel;
-
- static constexpr bool _UseCache = !is_reference_v<_InnerRange>;
- using _Cache = _If<_UseCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cache_;
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- join_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit join_view(_View __base)
- : __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
- constexpr bool __use_const = __simple_view<_View> &&
- is_reference_v<range_reference_t<_View>>;
- return __iterator<__use_const>{*this, ranges::begin(__base_)};
- }
-
- template<class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires input_range<const _V2> &&
- is_reference_v<range_reference_t<const _V2>>
- {
- return __iterator<true>{*this, ranges::begin(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
- if constexpr (forward_range<_View> &&
- is_reference_v<_InnerRange> &&
- forward_range<_InnerRange> &&
- common_range<_View> &&
- common_range<_InnerRange>)
- return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
- else
- return __sentinel<__simple_view<_View>>{*this};
- }
-
- template<class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires input_range<const _V2> &&
- is_reference_v<range_reference_t<const _V2>>
- {
- using _ConstInnerRange = range_reference_t<const _View>;
- if constexpr (forward_range<const _View> &&
- is_reference_v<_ConstInnerRange> &&
- forward_range<_ConstInnerRange> &&
- common_range<const _View> &&
- common_range<_ConstInnerRange>) {
- return __iterator<true>{*this, ranges::end(__base_)};
- } else {
- return __sentinel<true>{*this};
- }
- }
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- template<bool _Const> struct join_view<_View>::__sentinel {
- template<bool> friend struct __sentinel;
-
- private:
- using _Parent = __maybe_const<_Const, join_view>;
- using _Base = __maybe_const<_Const, _View>;
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(_Parent& __parent)
- : __end_(ranges::end(__parent.__base_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)) {}
-
- template<bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__outer_ == __y.__end_;
- }
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- template<bool _Const> struct join_view<_View>::__iterator
- : public __join_view_iterator_category<__maybe_const<_Const, _View>> {
-
- template<bool> friend struct __iterator;
-
- private:
- using _Parent = __maybe_const<_Const, join_view>;
- using _Base = __maybe_const<_Const, _View>;
- using _Outer = iterator_t<_Base>;
- using _Inner = iterator_t<range_reference_t<_Base>>;
-
- static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>;
-
- public:
- _Outer __outer_ = _Outer();
-
- private:
- optional<_Inner> __inner_;
- _Parent *__parent_ = nullptr;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr void __satisfy() {
- for (; __outer_ != ranges::end(__parent_->__base_); ++__outer_) {
- auto&& __inner = [&]() -> auto&& {
- if constexpr (__ref_is_glvalue)
- return *__outer_;
- else
- return __parent_->__cache_.__emplace_from([&]() -> decltype(auto) { return *__outer_; });
- }();
- __inner_ = ranges::begin(__inner);
- if (*__inner_ != ranges::end(__inner))
- return;
- }
-
- if constexpr (__ref_is_glvalue)
- __inner_.reset();
- }
-
- public:
- using iterator_concept = _If<
- __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>>,
- bidirectional_iterator_tag,
- _If<
- __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>,
- forward_iterator_tag,
- input_iterator_tag
- >
- >;
-
- using value_type = range_value_t<range_reference_t<_Base>>;
-
- using difference_type = common_type_t<
- range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>;
-
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<_Outer> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(_Parent& __parent, _Outer __outer)
- : __outer_(std::move(__outer))
- , __parent_(std::addressof(__parent)) {
- __satisfy();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
- requires _Const &&
- convertible_to<iterator_t<_View>, _Outer> &&
- convertible_to<iterator_t<_InnerRange>, _Inner>
- : __outer_(std::move(__i.__outer_))
- , __inner_(std::move(__i.__inner_))
- , __parent_(__i.__parent_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const {
- return **__inner_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Inner operator->() const
- requires __has_arrow<_Inner> && copyable<_Inner>
- {
- return *__inner_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- auto&& __inner = [&]() -> auto&& {
- if constexpr (__ref_is_glvalue)
- return *__outer_;
- else
- return *__parent_->__cache_;
- }();
- if (++*__inner_ == ranges::end(__inner)) {
- ++__outer_;
- __satisfy();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) {
- ++*this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
- requires __ref_is_glvalue &&
- forward_range<_Base> &&
- forward_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
- requires __ref_is_glvalue &&
- bidirectional_range<_Base> &&
- bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- if (__outer_ == ranges::end(__parent_->__base_))
- __inner_ = ranges::end(*--__outer_);
-
- // Skip empty inner ranges when going backwards.
- while (*__inner_ == ranges::begin(*__outer_)) {
- __inner_ = ranges::end(*--__outer_);
- }
-
- --*__inner_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
- requires __ref_is_glvalue &&
- bidirectional_range<_Base> &&
- bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires __ref_is_glvalue &&
- equality_comparable<iterator_t<_Base>> &&
- equality_comparable<iterator_t<range_reference_t<_Base>>>
- {
- return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __iterator& __i)
- noexcept(noexcept(ranges::iter_move(*__i.__inner_)))
- {
- return ranges::iter_move(*__i.__inner_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y)
- noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_)))
- requires indirectly_swappable<_Inner>
- {
- return ranges::iter_swap(*__x.__inner_, *__y.__inner_);
- }
- };
-
- template<class _Range>
- explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
-
-} // namespace ranges
-
-#undef _CONSTEXPR_TERNARY
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_JOIN_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h
deleted file mode 100644
index d9589ae46c..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H
-#define _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H
-
-#include <__config>
-#include <__iterator/concepts.h> // indirectly_readable
-#include <__iterator/iterator_traits.h> // iter_reference_t
-#include <__memory/addressof.h>
-#include <__utility/forward.h>
-#include <concepts> // constructible_from
-#include <optional>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- // __non_propagating_cache is a helper type that allows storing an optional value in it,
- // but which does not copy the source's value when it is copy constructed/assigned to,
- // and which resets the source's value when it is moved-from.
- //
- // This type is used as an implementation detail of some views that need to cache the
- // result of `begin()` in order to provide an amortized O(1) begin() method. Typically,
- // we don't want to propagate the value of the cache upon copy because the cached iterator
- // may refer to internal details of the source view.
- template<class _Tp>
- requires is_object_v<_Tp>
- class _LIBCPP_TEMPLATE_VIS __non_propagating_cache {
- struct __from_tag { };
- struct __forward_tag { };
-
- // This helper class is needed to perform copy and move elision when
- // constructing the contained type from an iterator.
- struct __wrapper {
- template<class ..._Args>
- constexpr explicit __wrapper(__forward_tag, _Args&& ...__args) : __t_(std::forward<_Args>(__args)...) { }
- template<class _Fn>
- constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) { }
- _Tp __t_;
- };
-
- optional<__wrapper> __value_ = nullopt;
-
- public:
- _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept
- : __value_(nullopt)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept
- : __value_(nullopt)
- {
- __other.__value_.reset();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept {
- if (this != std::addressof(__other)) {
- __value_.reset();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept {
- __value_.reset();
- __other.__value_.reset();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& operator*() { return __value_->__t_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp const& operator*() const { return __value_->__t_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __has_value() const { return __value_.has_value(); }
-
- template<class _Fn>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& __emplace_from(_Fn const& __f) {
- return __value_.emplace(__from_tag{}, __f).__t_;
- }
-
- template<class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& __emplace(_Args&& ...__args) {
- return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_;
- }
- };
-
- struct __empty_cache { };
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h
deleted file mode 100644
index 7987c60751..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_OWNING_VIEW_H
-#define _LIBCPP___RANGES_OWNING_VIEW_H
-
-#include <__concepts/constructible.h>
-#include <__concepts/movable.h>
-#include <__config>
-#include <__ranges/access.h>
-#include <__ranges/concepts.h>
-#include <__ranges/data.h>
-#include <__ranges/empty.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__utility/move.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<range _Rp>
- requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
- class owning_view : public view_interface<owning_view<_Rp>> {
- _Rp __r_ = _Rp();
-
-public:
- owning_view() requires default_initializable<_Rp> = default;
- _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {}
-
- owning_view(owning_view&&) = default;
- owning_view& operator=(owning_view&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires range<const _Rp> { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const requires range<const _Rp> { return ranges::end(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() requires requires { ranges::empty(__r_); }
- { return ranges::empty(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const requires requires { ranges::empty(__r_); }
- { return ranges::empty(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() requires sized_range<_Rp>
- { return ranges::size(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires sized_range<const _Rp>
- { return ranges::size(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() requires contiguous_range<_Rp>
- { return ranges::data(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() const requires contiguous_range<const _Rp>
- { return ranges::data(__r_); }
- };
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>;
-
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_OWNING_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h
deleted file mode 100644
index 9c53488ba6..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___RANGES_RANGE_ADAPTOR_H
-#define _LIBCPP___RANGES_RANGE_ADAPTOR_H
-
-#include <__config>
-#include <__functional/compose.h>
-#include <__functional/invoke.h>
-#include <__ranges/concepts.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
-#include <concepts>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-// CRTP base that one can derive from in order to be considered a range adaptor closure
-// by the library. When deriving from this class, a pipe operator will be provided to
-// make the following hold:
-// - `x | f` is equivalent to `f(x)`
-// - `f1 | f2` is an adaptor closure `g` such that `g(x)` is equivalent to `f2(f1(x))`
-template <class _Tp>
-struct __range_adaptor_closure;
-
-// Type that wraps an arbitrary function object and makes it into a range adaptor closure,
-// i.e. something that can be called via the `x | f` notation.
-template <class _Fn>
-struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> {
- constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) { }
-};
-
-template <class _Tp>
-concept _RangeAdaptorClosure = derived_from<remove_cvref_t<_Tp>, __range_adaptor_closure<remove_cvref_t<_Tp>>>;
-
-template <class _Tp>
-struct __range_adaptor_closure {
- template <ranges::viewable_range _View, _RangeAdaptorClosure _Closure>
- requires same_as<_Tp, remove_cvref_t<_Closure>> &&
- invocable<_Closure, _View>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) operator|(_View&& __view, _Closure&& __closure)
- noexcept(is_nothrow_invocable_v<_Closure, _View>)
- { return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view)); }
-
- template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
- requires same_as<_Tp, remove_cvref_t<_Closure>> &&
- constructible_from<decay_t<_Closure>, _Closure> &&
- constructible_from<decay_t<_OtherClosure>, _OtherClosure>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2)
- noexcept(is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
- is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>)
- { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); }
-};
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_RANGE_ADAPTOR_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h
deleted file mode 100644
index 20f5489c50..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_RBEGIN_H
-#define _LIBCPP___RANGES_RBEGIN_H
-
-#include <__concepts/class_or_enum.h>
-#include <__concepts/same_as.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/readable_traits.h>
-#include <__iterator/reverse_iterator.h>
-#include <__ranges/access.h>
-#include <__utility/auto_cast.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-// [ranges.access.rbegin]
-
-namespace ranges {
-namespace __rbegin {
-template <class _Tp>
-concept __member_rbegin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
- };
-
-void rbegin(auto&) = delete;
-void rbegin(const auto&) = delete;
-
-template <class _Tp>
-concept __unqualified_rbegin =
- !__member_rbegin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator;
- };
-
-template <class _Tp>
-concept __can_reverse =
- __can_borrow<_Tp> &&
- !__member_rbegin<_Tp> &&
- !__unqualified_rbegin<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
-
-struct __fn {
- template <class _Tp>
- requires __member_rbegin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin())))
- {
- return _LIBCPP_AUTO_CAST(__t.rbegin());
- }
-
- template <class _Tp>
- requires __unqualified_rbegin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t))))
- {
- return _LIBCPP_AUTO_CAST(rbegin(__t));
- }
-
- template <class _Tp>
- requires __can_reverse<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::end(__t)))
- {
- return std::make_reverse_iterator(ranges::end(__t));
- }
-
- void operator()(auto&&) const = delete;
-};
-} // namespace __rbegin
-
-inline namespace __cpo {
- inline constexpr auto rbegin = __rbegin::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.access.crbegin]
-
-namespace ranges {
-namespace __crbegin {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)); }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::rbegin(static_cast<const _Tp&&>(__t)))
- { return ranges::rbegin(static_cast<const _Tp&&>(__t)); }
-};
-} // namespace __crbegin
-
-inline namespace __cpo {
- inline constexpr auto crbegin = __crbegin::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_RBEGIN_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h
deleted file mode 100644
index 255a468606..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_REF_VIEW_H
-#define _LIBCPP___RANGES_REF_VIEW_H
-
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/incrementable_traits.h>
-#include <__iterator/iterator_traits.h>
-#include <__memory/addressof.h>
-#include <__ranges/access.h>
-#include <__ranges/concepts.h>
-#include <__ranges/data.h>
-#include <__ranges/empty.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__utility/forward.h>
-#include <concepts>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<range _Range>
- requires is_object_v<_Range>
- class ref_view : public view_interface<ref_view<_Range>> {
- _Range *__range_;
-
- static void __fun(_Range&);
- static void __fun(_Range&&) = delete;
-
-public:
- template<class _Tp>
- requires __different_from<_Tp, ref_view> &&
- convertible_to<_Tp, _Range&> && requires { __fun(declval<_Tp>()); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr ref_view(_Tp&& __t)
- : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t))))
- {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool empty() const
- requires requires { ranges::empty(*__range_); }
- { return ranges::empty(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires sized_range<_Range>
- { return ranges::size(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data() const
- requires contiguous_range<_Range>
- { return ranges::data(*__range_); }
- };
-
- template<class _Range>
- ref_view(_Range&) -> ref_view<_Range>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_REF_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h
deleted file mode 100644
index 4f1597e073..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_REND_H
-#define _LIBCPP___RANGES_REND_H
-
-#include <__concepts/class_or_enum.h>
-#include <__concepts/same_as.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/readable_traits.h>
-#include <__iterator/reverse_iterator.h>
-#include <__ranges/access.h>
-#include <__ranges/rbegin.h>
-#include <__utility/auto_cast.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-// [range.access.rend]
-
-namespace ranges {
-namespace __rend {
-template <class _Tp>
-concept __member_rend =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
-
-void rend(auto&) = delete;
-void rend(const auto&) = delete;
-
-template <class _Tp>
-concept __unqualified_rend =
- !__member_rend<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
-
-template <class _Tp>
-concept __can_reverse =
- __can_borrow<_Tp> &&
- !__member_rend<_Tp> &&
- !__unqualified_rend<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
-
-class __fn {
-public:
- template <class _Tp>
- requires __member_rend<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend())))
- {
- return _LIBCPP_AUTO_CAST(__t.rend());
- }
-
- template <class _Tp>
- requires __unqualified_rend<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t))))
- {
- return _LIBCPP_AUTO_CAST(rend(__t));
- }
-
- template <class _Tp>
- requires __can_reverse<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::begin(__t)))
- {
- return std::make_reverse_iterator(ranges::begin(__t));
- }
-
- void operator()(auto&&) const = delete;
-};
-} // namespace __rend
-
-inline namespace __cpo {
- inline constexpr auto rend = __rend::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.access.crend]
-
-namespace ranges {
-namespace __crend {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)); }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::rend(static_cast<const _Tp&&>(__t)))
- { return ranges::rend(static_cast<const _Tp&&>(__t)); }
-};
-} // namespace __crend
-
-inline namespace __cpo {
- inline constexpr auto crend = __crend::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_REND_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h
deleted file mode 100644
index c3ab6261f0..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_REVERSE_VIEW_H
-#define _LIBCPP___RANGES_REVERSE_VIEW_H
-
-#include <__concepts/constructible.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/next.h>
-#include <__iterator/reverse_iterator.h>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/concepts.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/non_propagating_cache.h>
-#include <__ranges/range_adaptor.h>
-#include <__ranges/size.h>
-#include <__ranges/subrange.h>
-#include <__ranges/view_interface.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<view _View>
- requires bidirectional_range<_View>
- class reverse_view : public view_interface<reverse_view<_View>> {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method.
- static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- reverse_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> begin() {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_)));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> begin() requires common_range<_View> {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires common_range<const _View> {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> end() {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires common_range<const _View> {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
- return ranges::size(__base_);
- }
- };
-
- template<class _Range>
- reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>;
-
- namespace views {
- namespace __reverse {
- template<class _Tp>
- constexpr bool __is_reverse_view = false;
-
- template<class _Tp>
- constexpr bool __is_reverse_view<reverse_view<_Tp>> = true;
-
- template<class _Tp>
- constexpr bool __is_sized_reverse_subrange = false;
-
- template<class _Iter>
- constexpr bool __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> = true;
-
- template<class _Tp>
- constexpr bool __is_unsized_reverse_subrange = false;
-
- template<class _Iter, subrange_kind _Kind>
- constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> = _Kind == subrange_kind::unsized;
-
- template<class _Tp>
- struct __unwrapped_reverse_subrange {
- using type = void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics
- };
-
- template<class _Iter, subrange_kind _Kind>
- struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> {
- using type = subrange<_Iter, _Iter, _Kind>;
- };
-
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- requires __is_reverse_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(std::forward<_Range>(__range).base()))
- -> decltype( std::forward<_Range>(__range).base())
- { return std::forward<_Range>(__range).base(); }
-
- template<class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_sized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())))
- -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()))
- { return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()); }
-
- template<class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base())))
- -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base()))
- { return _UnwrappedSubrange(__range.end().base(), __range.begin().base()); }
-
- template<class _Range>
- requires (!__is_reverse_view<remove_cvref_t<_Range>> &&
- !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
- !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(reverse_view{std::forward<_Range>(__range)}))
- -> decltype( reverse_view{std::forward<_Range>(__range)})
- { return reverse_view{std::forward<_Range>(__range)}; }
- };
- } // namespace __reverse
-
- inline namespace __cpo {
- inline constexpr auto reverse = __reverse::__fn{};
- } // namespace __cpo
- } // namespace views
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_REVERSE_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h
deleted file mode 100644
index e0fd4849f4..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_SINGLE_VIEW_H
-#define _LIBCPP___RANGES_SINGLE_VIEW_H
-
-#include <__config>
-#include <__ranges/copyable_box.h>
-#include <__ranges/view_interface.h>
-#include <__utility/forward.h>
-#include <__utility/in_place.h>
-#include <__utility/move.h>
-#include <concepts>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<copy_constructible _Tp>
- requires is_object_v<_Tp>
- class single_view : public view_interface<single_view<_Tp>> {
- __copyable_box<_Tp> __value_;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- single_view() requires default_initializable<_Tp> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit single_view(const _Tp& __t) : __value_(in_place, __t) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit single_view(_Tp&& __t) : __value_(in_place, std::move(__t)) {}
-
- template<class... _Args>
- requires constructible_from<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit single_view(in_place_t, _Args&&... __args)
- : __value_{in_place, std::forward<_Args>(__args)...} {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp* begin() noexcept { return data(); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr const _Tp* begin() const noexcept { return data(); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp* end() noexcept { return data() + 1; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr const _Tp* end() const noexcept { return data() + 1; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr size_t size() noexcept { return 1; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp* data() noexcept { return __value_.operator->(); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
- };
-
- template<class _Tp>
- single_view(_Tp) -> single_view<_Tp>;
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_SINGLE_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h
deleted file mode 100644
index c54f7710fc..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h
+++ /dev/null
@@ -1,289 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_SUBRANGE_H
-#define _LIBCPP___RANGES_SUBRANGE_H
-
-#include <__assert>
-#include <__concepts/constructible.h>
-#include <__concepts/convertible_to.h>
-#include <__concepts/copyable.h>
-#include <__concepts/derived_from.h>
-#include <__concepts/different_from.h>
-#include <__config>
-#include <__iterator/advance.h>
-#include <__iterator/concepts.h>
-#include <__iterator/incrementable_traits.h>
-#include <__iterator/iterator_traits.h>
-#include <__ranges/access.h>
-#include <__ranges/concepts.h>
-#include <__ranges/dangling.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__tuple>
-#include <__utility/move.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<class _From, class _To>
- concept __uses_nonqualification_pointer_conversion =
- is_pointer_v<_From> && is_pointer_v<_To> &&
- !convertible_to<remove_pointer_t<_From>(*)[], remove_pointer_t<_To>(*)[]>;
-
- template<class _From, class _To>
- concept __convertible_to_non_slicing =
- convertible_to<_From, _To> &&
- !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
-
- template<class _Tp>
- concept __pair_like =
- !is_reference_v<_Tp> && requires(_Tp __t) {
- typename tuple_size<_Tp>::type; // Ensures `tuple_size<T>` is complete.
- requires derived_from<tuple_size<_Tp>, integral_constant<size_t, 2>>;
- typename tuple_element_t<0, remove_const_t<_Tp>>;
- typename tuple_element_t<1, remove_const_t<_Tp>>;
- { std::get<0>(__t) } -> convertible_to<const tuple_element_t<0, _Tp>&>;
- { std::get<1>(__t) } -> convertible_to<const tuple_element_t<1, _Tp>&>;
- };
-
- template<class _Pair, class _Iter, class _Sent>
- concept __pair_like_convertible_from =
- !range<_Pair> && __pair_like<_Pair> &&
- constructible_from<_Pair, _Iter, _Sent> &&
- __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> &&
- convertible_to<_Sent, tuple_element_t<1, _Pair>>;
-
- enum class _LIBCPP_ENUM_VIS subrange_kind : bool { unsized, sized };
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent = _Iter,
- subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter>
- ? subrange_kind::sized
- : subrange_kind::unsized>
- requires (_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
- class _LIBCPP_TEMPLATE_VIS subrange
- : public view_interface<subrange<_Iter, _Sent, _Kind>>
- {
- private:
- static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
- static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
- struct _Empty { constexpr _Empty(auto) noexcept { } };
- using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter();
- _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent();
- _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- subrange() requires default_initializable<_Iter> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent)
- requires _MustProvideSizeAtConstruction
- : __begin_(std::move(__iter)), __end_(std::move(__sent))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent,
- make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires (_Kind == subrange_kind::sized)
- : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n)
- {
- if constexpr (sized_sentinel_for<_Sent, _Iter>)
- _LIBCPP_ASSERT((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n),
- "std::ranges::subrange was passed an invalid size hint");
- }
-
- template<__different_from<subrange> _Range>
- requires borrowed_range<_Range> &&
- __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range)
- requires (!_StoreSize)
- : subrange(ranges::begin(__range), ranges::end(__range))
- { }
-
- template<__different_from<subrange> _Range>
- requires borrowed_range<_Range> &&
- __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range)
- requires _StoreSize && sized_range<_Range>
- : subrange(__range, ranges::size(__range))
- { }
-
- template<borrowed_range _Range>
- requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires (_Kind == subrange_kind::sized)
- : subrange(ranges::begin(__range), ranges::end(__range), __n)
- { }
-
- template<__different_from<subrange> _Pair>
- requires __pair_like_convertible_from<_Pair, const _Iter&, const _Sent&>
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator _Pair() const {
- return _Pair(__begin_, __end_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Iter begin() const requires copyable<_Iter> {
- return __begin_;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() requires (!copyable<_Iter>) {
- return std::move(__begin_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Sent end() const {
- return __end_;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const {
- return __begin_ == __end_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
- requires (_Kind == subrange_kind::sized)
- {
- if constexpr (_StoreSize)
- return __size_;
- else
- return std::__to_unsigned_like(__end_ - __begin_);
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const&
- requires forward_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(__n);
- return __tmp;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && {
- advance(__n);
- return std::move(*this);
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const
- requires bidirectional_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(-__n);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange& advance(iter_difference_t<_Iter> __n) {
- if constexpr (bidirectional_iterator<_Iter>) {
- if (__n < 0) {
- ranges::advance(__begin_, __n);
- if constexpr (_StoreSize)
- __size_ += std::__to_unsigned_like(-__n);
- return *this;
- }
- }
-
- auto __d = __n - ranges::advance(__begin_, __n, __end_);
- if constexpr (_StoreSize)
- __size_ -= std::__to_unsigned_like(__d);
- return *this;
- }
- };
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>;
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>)
- -> subrange<_Iter, _Sent, subrange_kind::sized>;
-
- template<borrowed_range _Range>
- subrange(_Range&&) -> subrange<iterator_t<_Range>, sentinel_t<_Range>,
- (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
- ? subrange_kind::sized : subrange_kind::unsized>;
-
- template<borrowed_range _Range>
- subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
- -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>;
-
- template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires ((_Index == 0 && copyable<_Iter>) || _Index == 1)
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
- }
-
- template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires (_Index < 2)
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
- }
-
- template<class _Ip, class _Sp, subrange_kind _Kp>
- inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true;
-
- template<range _Rp>
- using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>;
-} // namespace ranges
-
-// [range.subrange.general]
-
-using ranges::get;
-
-// [ranges.syn]
-
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_size<ranges::subrange<_Ip, _Sp, _Kp>> : integral_constant<size_t, 2> {};
-
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<0, ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Ip;
-};
-
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<1, ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Sp;
-};
-
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<0, const ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Ip;
-};
-
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Sp;
-};
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_SUBRANGE_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h
deleted file mode 100644
index b5f194f9a0..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h
+++ /dev/null
@@ -1,185 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_TAKE_VIEW_H
-#define _LIBCPP___RANGES_TAKE_VIEW_H
-
-#include <__algorithm/min.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/counted_iterator.h>
-#include <__iterator/default_sentinel.h>
-#include <__iterator/iterator_traits.h>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/concepts.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__utility/move.h>
-#include <concepts>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
- template<view _View>
- class take_view : public view_interface<take_view<_View>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- range_difference_t<_View> __count_ = 0;
-
- template<bool> class __sentinel;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- take_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr take_view(_View __base, range_difference_t<_View> __count)
- : __base_(std::move(__base)), __count_(__count) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() requires (!__simple_view<_View>) {
- if constexpr (sized_range<_View>) {
- if constexpr (random_access_range<_View>) {
- return ranges::begin(__base_);
- } else {
- using _DifferenceT = range_difference_t<_View>;
- auto __size = size();
- return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
- }
- } else {
- return counted_iterator(ranges::begin(__base_), __count_);
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires range<const _View> {
- if constexpr (sized_range<const _View>) {
- if constexpr (random_access_range<const _View>) {
- return ranges::begin(__base_);
- } else {
- using _DifferenceT = range_difference_t<const _View>;
- auto __size = size();
- return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
- }
- } else {
- return counted_iterator(ranges::begin(__base_), __count_);
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() requires (!__simple_view<_View>) {
- if constexpr (sized_range<_View>) {
- if constexpr (random_access_range<_View>) {
- return ranges::begin(__base_) + size();
- } else {
- return default_sentinel;
- }
- } else {
- return __sentinel<false>{ranges::end(__base_)};
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires range<const _View> {
- if constexpr (sized_range<const _View>) {
- if constexpr (random_access_range<const _View>) {
- return ranges::begin(__base_) + size();
- } else {
- return default_sentinel;
- }
- } else {
- return __sentinel<true>{ranges::end(__base_)};
- }
- }
-
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
- auto __n = ranges::size(__base_);
- // TODO: use ranges::min here.
- return std::min(__n, static_cast<decltype(__n)>(__count_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
- auto __n = ranges::size(__base_);
- // TODO: use ranges::min here.
- return std::min(__n, static_cast<decltype(__n)>(__count_));
- }
- };
-
- template<view _View>
- template<bool _Const>
- class take_view<_View>::__sentinel {
- using _Base = __maybe_const<_Const, _View>;
- template<bool _OtherConst>
- using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>;
- _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- template<bool>
- friend class take_view<_View>::__sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_Base> base() const { return __end_; }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
- return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
- }
-
- template<bool _OtherConst = !_Const>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
- return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
- }
- };
-
- template<class _Range>
- take_view(_Range&&, range_difference_t<_Range>) -> take_view<views::all_t<_Range>>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<take_view<_Tp>> = enable_borrowed_range<_Tp>;
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___RANGES_TAKE_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h
deleted file mode 100644
index 4cc582faeb..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h
+++ /dev/null
@@ -1,440 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_TRANSFORM_VIEW_H
-#define _LIBCPP___RANGES_TRANSFORM_VIEW_H
-
-#include <__compare/three_way_comparable.h>
-#include <__concepts/constructible.h>
-#include <__concepts/convertible_to.h>
-#include <__concepts/copyable.h>
-#include <__concepts/derived_from.h>
-#include <__concepts/equality_comparable.h>
-#include <__concepts/invocable.h>
-#include <__config>
-#include <__functional/bind_back.h>
-#include <__functional/invoke.h>
-#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__memory/addressof.h>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/concepts.h>
-#include <__ranges/copyable_box.h>
-#include <__ranges/empty.h>
-#include <__ranges/range_adaptor.h>
-#include <__ranges/size.h>
-#include <__ranges/view_interface.h>
-#include <__utility/forward.h>
-#include <__utility/in_place.h>
-#include <__utility/move.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
-
-template<class _Fn, class _View>
-concept __regular_invocable_with_range_ref =
- regular_invocable<_Fn, range_reference_t<_View>>;
-
-template<class _View, class _Fn>
-concept __transform_view_constraints =
- view<_View> && is_object_v<_Fn> &&
- regular_invocable<_Fn&, range_reference_t<_View>> &&
- __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>;
-
-template<input_range _View, copy_constructible _Fn>
- requires __transform_view_constraints<_View, _Fn>
-class transform_view : public view_interface<transform_view<_View, _Fn>> {
- template<bool> class __iterator;
- template<bool> class __sentinel;
-
- _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Fn> __func_;
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI
- transform_view()
- requires default_initializable<_View> && default_initializable<_Fn> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr transform_view(_View __base, _Fn __func)
- : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<false> begin() {
- return __iterator<false>{*this, ranges::begin(__base_)};
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<true> begin() const
- requires range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
- {
- return __iterator<true>(*this, ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel<false> end() {
- return __sentinel<false>(ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<false> end()
- requires common_range<_View>
- {
- return __iterator<false>(*this, ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel<true> end() const
- requires range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
- {
- return __sentinel<true>(ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<true> end() const
- requires common_range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
- {
- return __iterator<true>(*this, ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> { return ranges::size(__base_); }
-};
-
-template<class _Range, class _Fn>
-transform_view(_Range&&, _Fn) -> transform_view<views::all_t<_Range>, _Fn>;
-
-template<class _View>
-struct __transform_view_iterator_concept { using type = input_iterator_tag; };
-
-template<random_access_range _View>
-struct __transform_view_iterator_concept<_View> { using type = random_access_iterator_tag; };
-
-template<bidirectional_range _View>
-struct __transform_view_iterator_concept<_View> { using type = bidirectional_iterator_tag; };
-
-template<forward_range _View>
-struct __transform_view_iterator_concept<_View> { using type = forward_iterator_tag; };
-
-template<class, class>
-struct __transform_view_iterator_category_base {};
-
-template<forward_range _View, class _Fn>
-struct __transform_view_iterator_category_base<_View, _Fn> {
- using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
-
- using iterator_category = conditional_t<
- is_lvalue_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>,
- conditional_t<
- derived_from<_Cat, contiguous_iterator_tag>,
- random_access_iterator_tag,
- _Cat
- >,
- input_iterator_tag
- >;
-};
-
-template<input_range _View, copy_constructible _Fn>
- requires __transform_view_constraints<_View, _Fn>
-template<bool _Const>
-class transform_view<_View, _Fn>::__iterator
- : public __transform_view_iterator_category_base<_View, _Fn> {
-
- using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
-
- _Parent *__parent_ = nullptr;
-
- template<bool>
- friend class transform_view<_View, _Fn>::__iterator;
-
- template<bool>
- friend class transform_view<_View, _Fn>::__sentinel;
-
-public:
- iterator_t<_Base> __current_ = iterator_t<_Base>();
-
- using iterator_concept = typename __transform_view_iterator_concept<_View>::type;
- using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>;
- using difference_type = range_difference_t<_Base>;
-
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<iterator_t<_Base>> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current)
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
-
- // Note: `__i` should always be `__iterator<false>`, but directly using
- // `__iterator<false>` is ill-formed when `_Const` is false
- // (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
- requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr const iterator_t<_Base>& base() const& noexcept {
- return __current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_Base> base() && {
- return std::move(__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const
- noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_)))
- {
- return std::invoke(*__parent_->__func_, *__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- ++__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++__current_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
- requires forward_range<_Base>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
- requires bidirectional_range<_Base>
- {
- --__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
- requires bidirectional_range<_Base>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __n)
- requires random_access_range<_Base>
- {
- __current_ += __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __n)
- requires random_access_range<_Base>
- {
- __current_ -= __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](difference_type __n) const
- noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
- requires random_access_range<_Base>
- {
- return std::invoke(*__parent_->__func_, __current_[__n]);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<iterator_t<_Base>>
- {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ < __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ > __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ <= __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ >= __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
- {
- return __x.__current_ <=> __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(__iterator __i, difference_type __n)
- requires random_access_range<_Base>
- {
- return __iterator{*__i.__parent_, __i.__current_ + __n};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, __iterator __i)
- requires random_access_range<_Base>
- {
- return __iterator{*__i.__parent_, __i.__current_ + __n};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(__iterator __i, difference_type __n)
- requires random_access_range<_Base>
- {
- return __iterator{*__i.__parent_, __i.__current_ - __n};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
- {
- return __x.__current_ - __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __iterator& __i)
- noexcept(noexcept(*__i))
- {
- if constexpr (is_lvalue_reference_v<decltype(*__i)>)
- return std::move(*__i);
- else
- return *__i;
- }
-};
-
-template<input_range _View, copy_constructible _Fn>
- requires __transform_view_constraints<_View, _Fn>
-template<bool _Const>
-class transform_view<_View, _Fn>::__sentinel {
- using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
-
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- template<bool>
- friend class transform_view<_View, _Fn>::__iterator;
-
- template<bool>
- friend class transform_view<_View, _Fn>::__sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
-
- // Note: `__i` should always be `__sentinel<false>`, but directly using
- // `__sentinel<false>` is ill-formed when `_Const` is false
- // (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __i)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__i.__end_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_Base> base() const { return __end_; }
-
- template<bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__current_ == __y.__end_;
- }
-
- template<bool _OtherConst>
- requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
- operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__current_ - __y.__end_;
- }
-
- template<bool _OtherConst>
- requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
- operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
- return __x.__end_ - __y.__current_;
- }
-};
-
-namespace views {
-namespace __transform {
- struct __fn {
- template<class _Range, class _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Fn&& __f) const
- noexcept(noexcept(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))))
- -> decltype( transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)))
- { return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)); }
-
- template<class _Fn>
- requires constructible_from<decay_t<_Fn>, _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn&& __f) const
- noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f))); }
- };
-} // namespace __transform
-
-inline namespace __cpo {
- inline constexpr auto transform = __transform::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_TRANSFORM_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h
deleted file mode 100644
index eecc475111..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h
+++ /dev/null
@@ -1,174 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_VIEW_INTERFACE_H
-#define _LIBCPP___RANGES_VIEW_INTERFACE_H
-
-#include <__assert>
-#include <__concepts/derived_from.h>
-#include <__concepts/same_as.h>
-#include <__config>
-#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__iterator/prev.h>
-#include <__memory/pointer_traits.h>
-#include <__ranges/access.h>
-#include <__ranges/concepts.h>
-#include <__ranges/empty.h>
-#include <type_traits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
-
-template<class _Derived>
- requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
-class view_interface {
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Derived& __derived() noexcept {
- static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
- return static_cast<_Derived&>(*this);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Derived const& __derived() const noexcept {
- static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
- return static_cast<_Derived const&>(*this);
- }
-
-public:
- template<class _D2 = _Derived>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
- requires forward_range<_D2>
- {
- return ranges::begin(__derived()) == ranges::end(__derived());
- }
-
- template<class _D2 = _Derived>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
- requires forward_range<const _D2>
- {
- return ranges::begin(__derived()) == ranges::end(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool()
- requires requires (_D2& __t) { ranges::empty(__t); }
- {
- return !ranges::empty(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const
- requires requires (const _D2& __t) { ranges::empty(__t); }
- {
- return !ranges::empty(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data()
- requires contiguous_iterator<iterator_t<_D2>>
- {
- return std::to_address(ranges::begin(__derived()));
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data() const
- requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>>
- {
- return std::to_address(ranges::begin(__derived()));
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
- requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>>
- {
- return ranges::end(__derived()) - ranges::begin(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>>
- {
- return ranges::end(__derived()) - ranges::begin(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) front()
- requires forward_range<_D2>
- {
- _LIBCPP_ASSERT(!empty(),
- "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
- return *ranges::begin(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) front() const
- requires forward_range<const _D2>
- {
- _LIBCPP_ASSERT(!empty(),
- "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
- return *ranges::begin(__derived());
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) back()
- requires bidirectional_range<_D2> && common_range<_D2>
- {
- _LIBCPP_ASSERT(!empty(),
- "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
- return *ranges::prev(ranges::end(__derived()));
- }
-
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) back() const
- requires bidirectional_range<const _D2> && common_range<const _D2>
- {
- _LIBCPP_ASSERT(!empty(),
- "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
- return *ranges::prev(ranges::end(__derived()));
- }
-
- template<random_access_range _RARange = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](range_difference_t<_RARange> __index)
- {
- return ranges::begin(__derived())[__index];
- }
-
- template<random_access_range _RARange = const _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const
- {
- return ranges::begin(__derived())[__index];
- }
-};
-
-} // namespace ranges
-
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_VIEW_INTERFACE_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h
deleted file mode 100644
index 8cc5ba3d2a..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___RANGES_VIEWS
-#define _LIBCPP___RANGES_VIEWS
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-namespace ranges {
-
-namespace views { }
-
-} // namespace ranges
-
-namespace views = ranges::views;
-
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___RANGES_VIEWS
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/cassert b/contrib/libs/cxxsupp/libcxxmsvc/include/cassert
deleted file mode 100644
index 3c5bb7b110..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/cassert
+++ /dev/null
@@ -1,24 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-/*
- cassert synopsis
-
-Macros:
-
- assert
-
-*/
-
-#include <__config>
-#include <assert.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex b/contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex
deleted file mode 100644
index f1037f2841..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex
+++ /dev/null
@@ -1,28 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_CCOMPLEX
-#define _LIBCPP_CCOMPLEX
-
-/*
- ccomplex synopsis
-
-#include <complex>
-
-*/
-
-#include <complex>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-// hh 080623 Created
-
-#endif // _LIBCPP_CCOMPLEX
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/cfenv b/contrib/libs/cxxsupp/libcxxmsvc/include/cfenv
deleted file mode 100644
index e1aae2f009..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/cfenv
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_CFENV
-#define _LIBCPP_CFENV
-
-/*
- cfenv synopsis
-
-This entire header is C99 / C++0X
-
-Macros:
-
- FE_DIVBYZERO
- FE_INEXACT
- FE_INVALID
- FE_OVERFLOW
- FE_UNDERFLOW
- FE_ALL_EXCEPT
- FE_DOWNWARD
- FE_TONEAREST
- FE_TOWARDZERO
- FE_UPWARD
- FE_DFL_ENV
-
-namespace std
-{
-
-Types:
-
- fenv_t
- fexcept_t
-
-int feclearexcept(int excepts);
-int fegetexceptflag(fexcept_t* flagp, int excepts);
-int feraiseexcept(int excepts);
-int fesetexceptflag(const fexcept_t* flagp, int excepts);
-int fetestexcept(int excepts);
-int fegetround();
-int fesetround(int round);
-int fegetenv(fenv_t* envp);
-int feholdexcept(fenv_t* envp);
-int fesetenv(const fenv_t* envp);
-int feupdateenv(const fenv_t* envp);
-
-} // std
-*/
-
-#include <__config>
-#include <fenv.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-using ::fenv_t _LIBCPP_USING_IF_EXISTS;
-using ::fexcept_t _LIBCPP_USING_IF_EXISTS;
-
-using ::feclearexcept _LIBCPP_USING_IF_EXISTS;
-using ::fegetexceptflag _LIBCPP_USING_IF_EXISTS;
-using ::feraiseexcept _LIBCPP_USING_IF_EXISTS;
-using ::fesetexceptflag _LIBCPP_USING_IF_EXISTS;
-using ::fetestexcept _LIBCPP_USING_IF_EXISTS;
-using ::fegetround _LIBCPP_USING_IF_EXISTS;
-using ::fesetround _LIBCPP_USING_IF_EXISTS;
-using ::fegetenv _LIBCPP_USING_IF_EXISTS;
-using ::feholdexcept _LIBCPP_USING_IF_EXISTS;
-using ::fesetenv _LIBCPP_USING_IF_EXISTS;
-using ::feupdateenv _LIBCPP_USING_IF_EXISTS;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CFENV
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes b/contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes
deleted file mode 100644
index 0674384b79..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes
+++ /dev/null
@@ -1,257 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_CINTTYPES
-#define _LIBCPP_CINTTYPES
-
-/*
- cinttypes synopsis
-
-This entire header is C99 / C++0X
-
-#include <cstdint> // <cinttypes> includes <cstdint>
-
-Macros:
-
- PRId8
- PRId16
- PRId32
- PRId64
-
- PRIdLEAST8
- PRIdLEAST16
- PRIdLEAST32
- PRIdLEAST64
-
- PRIdFAST8
- PRIdFAST16
- PRIdFAST32
- PRIdFAST64
-
- PRIdMAX
- PRIdPTR
-
- PRIi8
- PRIi16
- PRIi32
- PRIi64
-
- PRIiLEAST8
- PRIiLEAST16
- PRIiLEAST32
- PRIiLEAST64
-
- PRIiFAST8
- PRIiFAST16
- PRIiFAST32
- PRIiFAST64
-
- PRIiMAX
- PRIiPTR
-
- PRIo8
- PRIo16
- PRIo32
- PRIo64
-
- PRIoLEAST8
- PRIoLEAST16
- PRIoLEAST32
- PRIoLEAST64
-
- PRIoFAST8
- PRIoFAST16
- PRIoFAST32
- PRIoFAST64
-
- PRIoMAX
- PRIoPTR
-
- PRIu8
- PRIu16
- PRIu32
- PRIu64
-
- PRIuLEAST8
- PRIuLEAST16
- PRIuLEAST32
- PRIuLEAST64
-
- PRIuFAST8
- PRIuFAST16
- PRIuFAST32
- PRIuFAST64
-
- PRIuMAX
- PRIuPTR
-
- PRIx8
- PRIx16
- PRIx32
- PRIx64
-
- PRIxLEAST8
- PRIxLEAST16
- PRIxLEAST32
- PRIxLEAST64
-
- PRIxFAST8
- PRIxFAST16
- PRIxFAST32
- PRIxFAST64
-
- PRIxMAX
- PRIxPTR
-
- PRIX8
- PRIX16
- PRIX32
- PRIX64
-
- PRIXLEAST8
- PRIXLEAST16
- PRIXLEAST32
- PRIXLEAST64
-
- PRIXFAST8
- PRIXFAST16
- PRIXFAST32
- PRIXFAST64
-
- PRIXMAX
- PRIXPTR
-
- SCNd8
- SCNd16
- SCNd32
- SCNd64
-
- SCNdLEAST8
- SCNdLEAST16
- SCNdLEAST32
- SCNdLEAST64
-
- SCNdFAST8
- SCNdFAST16
- SCNdFAST32
- SCNdFAST64
-
- SCNdMAX
- SCNdPTR
-
- SCNi8
- SCNi16
- SCNi32
- SCNi64
-
- SCNiLEAST8
- SCNiLEAST16
- SCNiLEAST32
- SCNiLEAST64
-
- SCNiFAST8
- SCNiFAST16
- SCNiFAST32
- SCNiFAST64
-
- SCNiMAX
- SCNiPTR
-
- SCNo8
- SCNo16
- SCNo32
- SCNo64
-
- SCNoLEAST8
- SCNoLEAST16
- SCNoLEAST32
- SCNoLEAST64
-
- SCNoFAST8
- SCNoFAST16
- SCNoFAST32
- SCNoFAST64
-
- SCNoMAX
- SCNoPTR
-
- SCNu8
- SCNu16
- SCNu32
- SCNu64
-
- SCNuLEAST8
- SCNuLEAST16
- SCNuLEAST32
- SCNuLEAST64
-
- SCNuFAST8
- SCNuFAST16
- SCNuFAST32
- SCNuFAST64
-
- SCNuMAX
- SCNuPTR
-
- SCNx8
- SCNx16
- SCNx32
- SCNx64
-
- SCNxLEAST8
- SCNxLEAST16
- SCNxLEAST32
- SCNxLEAST64
-
- SCNxFAST8
- SCNxFAST16
- SCNxFAST32
- SCNxFAST64
-
- SCNxMAX
- SCNxPTR
-
-namespace std
-{
-
-Types:
-
- imaxdiv_t
-
-intmax_t imaxabs(intmax_t j);
-imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
-intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
-uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
-intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
-uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
-
-} // std
-*/
-
-#include <__config>
-#include <cstdint>
-#include <inttypes.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-using ::imaxdiv_t _LIBCPP_USING_IF_EXISTS;
-using ::imaxabs _LIBCPP_USING_IF_EXISTS;
-using ::imaxdiv _LIBCPP_USING_IF_EXISTS;
-using ::strtoimax _LIBCPP_USING_IF_EXISTS;
-using ::strtoumax _LIBCPP_USING_IF_EXISTS;
-using ::wcstoimax _LIBCPP_USING_IF_EXISTS;
-using ::wcstoumax _LIBCPP_USING_IF_EXISTS;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CINTTYPES
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/ciso646 b/contrib/libs/cxxsupp/libcxxmsvc/include/ciso646
deleted file mode 100644
index 1d859f08fa..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/ciso646
+++ /dev/null
@@ -1,24 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_CISO646
-#define _LIBCPP_CISO646
-
-/*
- ciso646 synopsis
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#endif // _LIBCPP_CISO646
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/complex b/contrib/libs/cxxsupp/libcxxmsvc/include/complex
deleted file mode 100644
index a11334f6cf..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/complex
+++ /dev/null
@@ -1,1496 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_COMPLEX
-#define _LIBCPP_COMPLEX
-
-/*
- complex synopsis
-
-namespace std
-{
-
-template<class T>
-class complex
-{
-public:
- typedef T value_type;
-
- complex(const T& re = T(), const T& im = T()); // constexpr in C++14
- complex(const complex&); // constexpr in C++14
- template<class X> complex(const complex<X>&); // constexpr in C++14
-
- T real() const; // constexpr in C++14
- T imag() const; // constexpr in C++14
-
- void real(T);
- void imag(T);
-
- complex<T>& operator= (const T&);
- complex<T>& operator+=(const T&);
- complex<T>& operator-=(const T&);
- complex<T>& operator*=(const T&);
- complex<T>& operator/=(const T&);
-
- complex& operator=(const complex&);
- template<class X> complex<T>& operator= (const complex<X>&);
- template<class X> complex<T>& operator+=(const complex<X>&);
- template<class X> complex<T>& operator-=(const complex<X>&);
- template<class X> complex<T>& operator*=(const complex<X>&);
- template<class X> complex<T>& operator/=(const complex<X>&);
-};
-
-template<>
-class complex<float>
-{
-public:
- typedef float value_type;
-
- constexpr complex(float re = 0.0f, float im = 0.0f);
- explicit constexpr complex(const complex<double>&);
- explicit constexpr complex(const complex<long double>&);
-
- constexpr float real() const;
- void real(float);
- constexpr float imag() const;
- void imag(float);
-
- complex<float>& operator= (float);
- complex<float>& operator+=(float);
- complex<float>& operator-=(float);
- complex<float>& operator*=(float);
- complex<float>& operator/=(float);
-
- complex<float>& operator=(const complex<float>&);
- template<class X> complex<float>& operator= (const complex<X>&);
- template<class X> complex<float>& operator+=(const complex<X>&);
- template<class X> complex<float>& operator-=(const complex<X>&);
- template<class X> complex<float>& operator*=(const complex<X>&);
- template<class X> complex<float>& operator/=(const complex<X>&);
-};
-
-template<>
-class complex<double>
-{
-public:
- typedef double value_type;
-
- constexpr complex(double re = 0.0, double im = 0.0);
- constexpr complex(const complex<float>&);
- explicit constexpr complex(const complex<long double>&);
-
- constexpr double real() const;
- void real(double);
- constexpr double imag() const;
- void imag(double);
-
- complex<double>& operator= (double);
- complex<double>& operator+=(double);
- complex<double>& operator-=(double);
- complex<double>& operator*=(double);
- complex<double>& operator/=(double);
- complex<double>& operator=(const complex<double>&);
-
- template<class X> complex<double>& operator= (const complex<X>&);
- template<class X> complex<double>& operator+=(const complex<X>&);
- template<class X> complex<double>& operator-=(const complex<X>&);
- template<class X> complex<double>& operator*=(const complex<X>&);
- template<class X> complex<double>& operator/=(const complex<X>&);
-};
-
-template<>
-class complex<long double>
-{
-public:
- typedef long double value_type;
-
- constexpr complex(long double re = 0.0L, long double im = 0.0L);
- constexpr complex(const complex<float>&);
- constexpr complex(const complex<double>&);
-
- constexpr long double real() const;
- void real(long double);
- constexpr long double imag() const;
- void imag(long double);
-
- complex<long double>& operator=(const complex<long double>&);
- complex<long double>& operator= (long double);
- complex<long double>& operator+=(long double);
- complex<long double>& operator-=(long double);
- complex<long double>& operator*=(long double);
- complex<long double>& operator/=(long double);
-
- template<class X> complex<long double>& operator= (const complex<X>&);
- template<class X> complex<long double>& operator+=(const complex<X>&);
- template<class X> complex<long double>& operator-=(const complex<X>&);
- template<class X> complex<long double>& operator*=(const complex<X>&);
- template<class X> complex<long double>& operator/=(const complex<X>&);
-};
-
-// 26.3.6 operators:
-template<class T> complex<T> operator+(const complex<T>&, const complex<T>&);
-template<class T> complex<T> operator+(const complex<T>&, const T&);
-template<class T> complex<T> operator+(const T&, const complex<T>&);
-template<class T> complex<T> operator-(const complex<T>&, const complex<T>&);
-template<class T> complex<T> operator-(const complex<T>&, const T&);
-template<class T> complex<T> operator-(const T&, const complex<T>&);
-template<class T> complex<T> operator*(const complex<T>&, const complex<T>&);
-template<class T> complex<T> operator*(const complex<T>&, const T&);
-template<class T> complex<T> operator*(const T&, const complex<T>&);
-template<class T> complex<T> operator/(const complex<T>&, const complex<T>&);
-template<class T> complex<T> operator/(const complex<T>&, const T&);
-template<class T> complex<T> operator/(const T&, const complex<T>&);
-template<class T> complex<T> operator+(const complex<T>&);
-template<class T> complex<T> operator-(const complex<T>&);
-template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
-template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
-template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
-template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
-template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
-template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
-
-template<class T, class charT, class traits>
- basic_istream<charT, traits>&
- operator>>(basic_istream<charT, traits>&, complex<T>&);
-template<class T, class charT, class traits>
- basic_ostream<charT, traits>&
- operator<<(basic_ostream<charT, traits>&, const complex<T>&);
-
-// 26.3.7 values:
-
-template<class T> T real(const complex<T>&); // constexpr in C++14
- long double real(long double); // constexpr in C++14
- double real(double); // constexpr in C++14
-template<Integral T> double real(T); // constexpr in C++14
- float real(float); // constexpr in C++14
-
-template<class T> T imag(const complex<T>&); // constexpr in C++14
- long double imag(long double); // constexpr in C++14
- double imag(double); // constexpr in C++14
-template<Integral T> double imag(T); // constexpr in C++14
- float imag(float); // constexpr in C++14
-
-template<class T> T abs(const complex<T>&);
-
-template<class T> T arg(const complex<T>&);
- long double arg(long double);
- double arg(double);
-template<Integral T> double arg(T);
- float arg(float);
-
-template<class T> T norm(const complex<T>&);
- long double norm(long double);
- double norm(double);
-template<Integral T> double norm(T);
- float norm(float);
-
-template<class T> complex<T> conj(const complex<T>&);
- complex<long double> conj(long double);
- complex<double> conj(double);
-template<Integral T> complex<double> conj(T);
- complex<float> conj(float);
-
-template<class T> complex<T> proj(const complex<T>&);
- complex<long double> proj(long double);
- complex<double> proj(double);
-template<Integral T> complex<double> proj(T);
- complex<float> proj(float);
-
-template<class T> complex<T> polar(const T&, const T& = T());
-
-// 26.3.8 transcendentals:
-template<class T> complex<T> acos(const complex<T>&);
-template<class T> complex<T> asin(const complex<T>&);
-template<class T> complex<T> atan(const complex<T>&);
-template<class T> complex<T> acosh(const complex<T>&);
-template<class T> complex<T> asinh(const complex<T>&);
-template<class T> complex<T> atanh(const complex<T>&);
-template<class T> complex<T> cos (const complex<T>&);
-template<class T> complex<T> cosh (const complex<T>&);
-template<class T> complex<T> exp (const complex<T>&);
-template<class T> complex<T> log (const complex<T>&);
-template<class T> complex<T> log10(const complex<T>&);
-
-template<class T> complex<T> pow(const complex<T>&, const T&);
-template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
-template<class T> complex<T> pow(const T&, const complex<T>&);
-
-template<class T> complex<T> sin (const complex<T>&);
-template<class T> complex<T> sinh (const complex<T>&);
-template<class T> complex<T> sqrt (const complex<T>&);
-template<class T> complex<T> tan (const complex<T>&);
-template<class T> complex<T> tanh (const complex<T>&);
-
-} // std
-
-*/
-
-#include <__config>
-#include <cmath>
-#include <iosfwd>
-#include <stdexcept>
-#include <type_traits>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <sstream> // for std::basic_ostringstream
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS complex;
-
-template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
-template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
-
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS complex
-{
-public:
- typedef _Tp value_type;
-private:
- value_type __re_;
- value_type __im_;
-public:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
- complex(const value_type& __re = value_type(), const value_type& __im = value_type())
- : __re_(__re), __im_(__im) {}
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
- complex(const complex<_Xp>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;}
-
- _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
- _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
-};
-
-template<> class _LIBCPP_TEMPLATE_VIS complex<double>;
-template<> class _LIBCPP_TEMPLATE_VIS complex<long double>;
-
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<float>
-{
- float __re_;
- float __im_;
-public:
- typedef float value_type;
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_INLINE_VISIBILITY
- explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
- _LIBCPP_INLINE_VISIBILITY
- explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
-
- _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
- _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
-};
-
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<double>
-{
- double __re_;
- double __im_;
-public:
- typedef double value_type;
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
- _LIBCPP_INLINE_VISIBILITY
- explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
-
- _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
- _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
-};
-
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<long double>
-{
- long double __re_;
- long double __im_;
-public:
- typedef long double value_type;
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
-
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
-
- _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
- _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_INLINE_VISIBILITY complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
-};
-
-inline
-_LIBCPP_CONSTEXPR
-complex<float>::complex(const complex<double>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
-inline
-_LIBCPP_CONSTEXPR
-complex<float>::complex(const complex<long double>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
-inline
-_LIBCPP_CONSTEXPR
-complex<double>::complex(const complex<float>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
-inline
-_LIBCPP_CONSTEXPR
-complex<double>::complex(const complex<long double>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
-inline
-_LIBCPP_CONSTEXPR
-complex<long double>::complex(const complex<float>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
-inline
-_LIBCPP_CONSTEXPR
-complex<long double>::complex(const complex<double>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
-// 26.3.6 operators:
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t += __y;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator+(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t += __y;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator+(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__y);
- __t += __x;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t -= __y;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator-(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t -= __y;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator-(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(-__y);
- __t += __x;
- return __t;
-}
-
-template<class _Tp>
-complex<_Tp>
-operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
-{
- _Tp __a = __z.real();
- _Tp __b = __z.imag();
- _Tp __c = __w.real();
- _Tp __d = __w.imag();
- _Tp __ac = __a * __c;
- _Tp __bd = __b * __d;
- _Tp __ad = __a * __d;
- _Tp __bc = __b * __c;
- _Tp __x = __ac - __bd;
- _Tp __y = __ad + __bc;
- if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
- {
- bool __recalc = false;
- if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b))
- {
- __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
- __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
- if (__libcpp_isnan_or_builtin(__c))
- __c = copysign(_Tp(0), __c);
- if (__libcpp_isnan_or_builtin(__d))
- __d = copysign(_Tp(0), __d);
- __recalc = true;
- }
- if (__libcpp_isinf_or_builtin(__c) || __libcpp_isinf_or_builtin(__d))
- {
- __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
- __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
- if (__libcpp_isnan_or_builtin(__a))
- __a = copysign(_Tp(0), __a);
- if (__libcpp_isnan_or_builtin(__b))
- __b = copysign(_Tp(0), __b);
- __recalc = true;
- }
- if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) ||
- __libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc)))
- {
- if (__libcpp_isnan_or_builtin(__a))
- __a = copysign(_Tp(0), __a);
- if (__libcpp_isnan_or_builtin(__b))
- __b = copysign(_Tp(0), __b);
- if (__libcpp_isnan_or_builtin(__c))
- __c = copysign(_Tp(0), __c);
- if (__libcpp_isnan_or_builtin(__d))
- __d = copysign(_Tp(0), __d);
- __recalc = true;
- }
- if (__recalc)
- {
- __x = _Tp(INFINITY) * (__a * __c - __b * __d);
- __y = _Tp(INFINITY) * (__a * __d + __b * __c);
- }
- }
- return complex<_Tp>(__x, __y);
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator*(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t *= __y;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator*(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__y);
- __t *= __x;
- return __t;
-}
-
-template<class _Tp>
-complex<_Tp>
-operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
-{
- int __ilogbw = 0;
- _Tp __a = __z.real();
- _Tp __b = __z.imag();
- _Tp __c = __w.real();
- _Tp __d = __w.imag();
- _Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
- if (__libcpp_isfinite_or_builtin(__logbw))
- {
- __ilogbw = static_cast<int>(__logbw);
- __c = scalbn(__c, -__ilogbw);
- __d = scalbn(__d, -__ilogbw);
- }
- _Tp __denom = __c * __c + __d * __d;
- _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
- _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
- if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
- {
- if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b)))
- {
- __x = copysign(_Tp(INFINITY), __c) * __a;
- __y = copysign(_Tp(INFINITY), __c) * __b;
- }
- else if ((__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) && __libcpp_isfinite_or_builtin(__c) && __libcpp_isfinite_or_builtin(__d))
- {
- __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
- __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
- __x = _Tp(INFINITY) * (__a * __c + __b * __d);
- __y = _Tp(INFINITY) * (__b * __c - __a * __d);
- }
- else if (__libcpp_isinf_or_builtin(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite_or_builtin(__a) && __libcpp_isfinite_or_builtin(__b))
- {
- __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
- __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
- __x = _Tp(0) * (__a * __c + __b * __d);
- __y = _Tp(0) * (__b * __c - __a * __d);
- }
- }
- return complex<_Tp>(__x, __y);
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator/(const complex<_Tp>& __x, const _Tp& __y)
-{
- return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator/(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t /= __y;
- return __t;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator+(const complex<_Tp>& __x)
-{
- return __x;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-operator-(const complex<_Tp>& __x)
-{
- return complex<_Tp>(-__x.real(), -__x.imag());
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-bool
-operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return __x.real() == __y.real() && __x.imag() == __y.imag();
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-bool
-operator==(const complex<_Tp>& __x, const _Tp& __y)
-{
- return __x.real() == __y && __x.imag() == 0;
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-bool
-operator==(const _Tp& __x, const complex<_Tp>& __y)
-{
- return __x == __y.real() && 0 == __y.imag();
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-bool
-operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return !(__x == __y);
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-bool
-operator!=(const complex<_Tp>& __x, const _Tp& __y)
-{
- return !(__x == __y);
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-bool
-operator!=(const _Tp& __x, const complex<_Tp>& __y)
-{
- return !(__x == __y);
-}
-
-// 26.3.7 values:
-
-template <class _Tp, bool = is_integral<_Tp>::value,
- bool = is_floating_point<_Tp>::value
- >
-struct __libcpp_complex_overload_traits {};
-
-// Integral Types
-template <class _Tp>
-struct __libcpp_complex_overload_traits<_Tp, true, false>
-{
- typedef double _ValueType;
- typedef complex<double> _ComplexType;
-};
-
-// Floating point types
-template <class _Tp>
-struct __libcpp_complex_overload_traits<_Tp, false, true>
-{
- typedef _Tp _ValueType;
- typedef complex<_Tp> _ComplexType;
-};
-
-// real
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-_Tp
-real(const complex<_Tp>& __c)
-{
- return __c.real();
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-real(_Tp __re)
-{
- return __re;
-}
-
-// imag
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-_Tp
-imag(const complex<_Tp>& __c)
-{
- return __c.imag();
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-imag(_Tp)
-{
- return 0;
-}
-
-// abs
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-abs(const complex<_Tp>& __c)
-{
- return hypot(__c.real(), __c.imag());
-}
-
-// arg
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-arg(const complex<_Tp>& __c)
-{
- return atan2(__c.imag(), __c.real());
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<
- is_same<_Tp, long double>::value,
- long double
->::type
-arg(_Tp __re)
-{
- return atan2l(0.L, __re);
-}
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_integral<_Tp>::value || is_same<_Tp, double>::value,
- double
->::type
-arg(_Tp __re)
-{
- return atan2(0., __re);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<
- is_same<_Tp, float>::value,
- float
->::type
-arg(_Tp __re)
-{
- return atan2f(0.F, __re);
-}
-
-// norm
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-norm(const complex<_Tp>& __c)
-{
- if (__libcpp_isinf_or_builtin(__c.real()))
- return abs(__c.real());
- if (__libcpp_isinf_or_builtin(__c.imag()))
- return abs(__c.imag());
- return __c.real() * __c.real() + __c.imag() * __c.imag();
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-norm(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType;
- return static_cast<_ValueType>(__re) * __re;
-}
-
-// conj
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-conj(const complex<_Tp>& __c)
-{
- return complex<_Tp>(__c.real(), -__c.imag());
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-conj(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
- return _ComplexType(__re);
-}
-
-
-
-// proj
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-proj(const complex<_Tp>& __c)
-{
- complex<_Tp> __r = __c;
- if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
- __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
- return __r;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_floating_point<_Tp>::value,
- typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
->::type
-proj(_Tp __re)
-{
- if (__libcpp_isinf_or_builtin(__re))
- __re = abs(__re);
- return complex<_Tp>(__re);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_integral<_Tp>::value,
- typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
->::type
-proj(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
- return _ComplexType(__re);
-}
-
-// polar
-
-template<class _Tp>
-complex<_Tp>
-polar(const _Tp& __rho, const _Tp& __theta = _Tp())
-{
- if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho))
- return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- if (__libcpp_isnan_or_builtin(__theta))
- {
- if (__libcpp_isinf_or_builtin(__rho))
- return complex<_Tp>(__rho, __theta);
- return complex<_Tp>(__theta, __theta);
- }
- if (__libcpp_isinf_or_builtin(__theta))
- {
- if (__libcpp_isinf_or_builtin(__rho))
- return complex<_Tp>(__rho, _Tp(NAN));
- return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- }
- _Tp __x = __rho * cos(__theta);
- if (__libcpp_isnan_or_builtin(__x))
- __x = 0;
- _Tp __y = __rho * sin(__theta);
- if (__libcpp_isnan_or_builtin(__y))
- __y = 0;
- return complex<_Tp>(__x, __y);
-}
-
-// log
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-log(const complex<_Tp>& __x)
-{
- return complex<_Tp>(log(abs(__x)), arg(__x));
-}
-
-// log10
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-log10(const complex<_Tp>& __x)
-{
- return log(__x) / log(_Tp(10));
-}
-
-// sqrt
-
-template<class _Tp>
-complex<_Tp>
-sqrt(const complex<_Tp>& __x)
-{
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(_Tp(INFINITY), __x.imag());
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- if (__x.real() > _Tp(0))
- return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
- return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
- }
- return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
-}
-
-// exp
-
-template<class _Tp>
-complex<_Tp>
-exp(const complex<_Tp>& __x)
-{
- _Tp __i = __x.imag();
- if (__i == 0) {
- return complex<_Tp>(exp(__x.real()), copysign(_Tp(0), __x.imag()));
- }
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- if (__x.real() < _Tp(0))
- {
- if (!__libcpp_isfinite_or_builtin(__i))
- __i = _Tp(1);
- }
- else if (__i == 0 || !__libcpp_isfinite_or_builtin(__i))
- {
- if (__libcpp_isinf_or_builtin(__i))
- __i = _Tp(NAN);
- return complex<_Tp>(__x.real(), __i);
- }
- }
- _Tp __e = exp(__x.real());
- return complex<_Tp>(__e * cos(__i), __e * sin(__i));
-}
-
-// pow
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return exp(__y * log(__x));
-}
-
-template<class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<typename __promote<_Tp, _Up>::type>
-pow(const complex<_Tp>& __x, const complex<_Up>& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return _VSTD::pow(result_type(__x), result_type(__y));
-}
-
-template<class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_arithmetic<_Up>::value,
- complex<typename __promote<_Tp, _Up>::type>
->::type
-pow(const complex<_Tp>& __x, const _Up& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return _VSTD::pow(result_type(__x), result_type(__y));
-}
-
-template<class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_arithmetic<_Tp>::value,
- complex<typename __promote<_Tp, _Up>::type>
->::type
-pow(const _Tp& __x, const complex<_Up>& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return _VSTD::pow(result_type(__x), result_type(__y));
-}
-
-// __sqr, computes pow(x, 2)
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-__sqr(const complex<_Tp>& __x)
-{
- return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()),
- _Tp(2) * __x.real() * __x.imag());
-}
-
-// asinh
-
-template<class _Tp>
-complex<_Tp>
-asinh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- if (__libcpp_isnan_or_builtin(__x.imag()))
- return __x;
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
- return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
- }
- if (__libcpp_isnan_or_builtin(__x.real()))
- {
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(__x.imag(), __x.real());
- if (__x.imag() == 0)
- return __x;
- return complex<_Tp>(__x.real(), __x.real());
- }
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1)));
- return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
-}
-
-// acosh
-
-template<class _Tp>
-complex<_Tp>
-acosh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- if (__libcpp_isnan_or_builtin(__x.imag()))
- return complex<_Tp>(abs(__x.real()), __x.imag());
- if (__libcpp_isinf_or_builtin(__x.imag()))
- {
- if (__x.real() > 0)
- return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
- else
- return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
- }
- if (__x.real() < 0)
- return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
- return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
- }
- if (__libcpp_isnan_or_builtin(__x.real()))
- {
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(abs(__x.imag()), __x.real());
- return complex<_Tp>(__x.real(), __x.real());
- }
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
- return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
-}
-
-// atanh
-
-template<class _Tp>
-complex<_Tp>
-atanh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf_or_builtin(__x.imag()))
- {
- return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
- }
- if (__libcpp_isnan_or_builtin(__x.imag()))
- {
- if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0)
- return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
- return complex<_Tp>(__x.imag(), __x.imag());
- }
- if (__libcpp_isnan_or_builtin(__x.real()))
- {
- return complex<_Tp>(__x.real(), __x.real());
- }
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
- }
- if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
- {
- return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag()));
- }
- complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
- return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
-}
-
-// sinh
-
-template<class _Tp>
-complex<_Tp>
-sinh(const complex<_Tp>& __x)
-{
- if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
- return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
- return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
- return __x;
- return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
-}
-
-// cosh
-
-template<class _Tp>
-complex<_Tp>
-cosh(const complex<_Tp>& __x)
-{
- if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
- return complex<_Tp>(abs(__x.real()), _Tp(NAN));
- if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
- return complex<_Tp>(_Tp(NAN), __x.real());
- if (__x.real() == 0 && __x.imag() == 0)
- return complex<_Tp>(_Tp(1), __x.imag());
- if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
- return complex<_Tp>(abs(__x.real()), __x.imag());
- return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
-}
-
-// tanh
-
-template<class _Tp>
-complex<_Tp>
-tanh(const complex<_Tp>& __x)
-{
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- if (!__libcpp_isfinite_or_builtin(__x.imag()))
- return complex<_Tp>(copysign(_Tp(1), __x.real()), _Tp(0));
- return complex<_Tp>(copysign(_Tp(1), __x.real()), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
- }
- if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
- return __x;
- _Tp __2r(_Tp(2) * __x.real());
- _Tp __2i(_Tp(2) * __x.imag());
- _Tp __d(cosh(__2r) + cos(__2i));
- _Tp __2rsh(sinh(__2r));
- if (__libcpp_isinf_or_builtin(__2rsh) && __libcpp_isinf_or_builtin(__d))
- return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
- __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
- return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
-}
-
-// asin
-
-template<class _Tp>
-complex<_Tp>
-asin(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
-}
-
-// acos
-
-template<class _Tp>
-complex<_Tp>
-acos(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf_or_builtin(__x.real()))
- {
- if (__libcpp_isnan_or_builtin(__x.imag()))
- return complex<_Tp>(__x.imag(), __x.real());
- if (__libcpp_isinf_or_builtin(__x.imag()))
- {
- if (__x.real() < _Tp(0))
- return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
- return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
- }
- if (__x.real() < _Tp(0))
- return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
- return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
- }
- if (__libcpp_isnan_or_builtin(__x.real()))
- {
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(__x.real(), -__x.imag());
- return complex<_Tp>(__x.real(), __x.real());
- }
- if (__libcpp_isinf_or_builtin(__x.imag()))
- return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
- return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
- if (signbit(__x.imag()))
- return complex<_Tp>(abs(__z.imag()), abs(__z.real()));
- return complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
-}
-
-// atan
-
-template<class _Tp>
-complex<_Tp>
-atan(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
-}
-
-// sin
-
-template<class _Tp>
-complex<_Tp>
-sin(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
-}
-
-// cos
-
-template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-complex<_Tp>
-cos(const complex<_Tp>& __x)
-{
- return cosh(complex<_Tp>(-__x.imag(), __x.real()));
-}
-
-// tan
-
-template<class _Tp>
-complex<_Tp>
-tan(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
-}
-
-template<class _Tp, class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
-{
- if (__is.good())
- {
- ws(__is);
- if (__is.peek() == _CharT('('))
- {
- __is.get();
- _Tp __r;
- __is >> __r;
- if (!__is.fail())
- {
- ws(__is);
- _CharT __c = __is.peek();
- if (__c == _CharT(','))
- {
- __is.get();
- _Tp __i;
- __is >> __i;
- if (!__is.fail())
- {
- ws(__is);
- __c = __is.peek();
- if (__c == _CharT(')'))
- {
- __is.get();
- __x = complex<_Tp>(__r, __i);
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- __is.setstate(__is.failbit);
- }
- else if (__c == _CharT(')'))
- {
- __is.get();
- __x = complex<_Tp>(__r, _Tp(0));
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- {
- _Tp __r;
- __is >> __r;
- if (!__is.fail())
- __x = complex<_Tp>(__r, _Tp(0));
- else
- __is.setstate(__is.failbit);
- }
- }
- else
- __is.setstate(__is.failbit);
- return __is;
-}
-
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-template<class _Tp, class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
-{
- basic_ostringstream<_CharT, _Traits> __s;
- __s.flags(__os.flags());
- __s.imbue(__os.getloc());
- __s.precision(__os.precision());
- __s << '(' << __x.real() << ',' << __x.imag() << ')';
- return __os << __s.str();
-}
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
-
-#if _LIBCPP_STD_VER > 11
-// Literal suffix for complex number literals [complex.literals]
-inline namespace literals
-{
- inline namespace complex_literals
- {
- constexpr complex<long double> operator""il(long double __im)
- {
- return { 0.0l, __im };
- }
-
- constexpr complex<long double> operator""il(unsigned long long __im)
- {
- return { 0.0l, static_cast<long double>(__im) };
- }
-
-
- constexpr complex<double> operator""i(long double __im)
- {
- return { 0.0, static_cast<double>(__im) };
- }
-
- constexpr complex<double> operator""i(unsigned long long __im)
- {
- return { 0.0, static_cast<double>(__im) };
- }
-
-
-#if !defined(__CUDACC__)
- constexpr complex<float> operator""if(long double __im)
- {
- return { 0.0f, static_cast<float>(__im) };
- }
-
- constexpr complex<float> operator""if(unsigned long long __im)
- {
- return { 0.0f, static_cast<float>(__im) };
- }
-#endif
- } // namespace complex_literals
-} // namespace literals
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_COMPLEX
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/complex.h b/contrib/libs/cxxsupp/libcxxmsvc/include/complex.h
deleted file mode 100644
index 58cbbaaeef..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/complex.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_COMPLEX_H
-#define _LIBCPP_COMPLEX_H
-
-/*
- complex.h synopsis
-
-#include <ccomplex>
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-
-#include <ccomplex>
-
-#else // __cplusplus
-
-#ifdef _LIBCPP_COMPILER_MSVC
-#include Y_UCRT_INCLUDE_NEXT(complex.h)
-#else
-#include_next <complex.h>
-#endif
-
-#endif // __cplusplus
-
-#endif // _LIBCPP_COMPLEX_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/coroutine b/contrib/libs/cxxsupp/libcxxmsvc/include/coroutine
deleted file mode 100644
index 478f4723f9..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/coroutine
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_COROUTINE
-#define _LIBCPP_COROUTINE
-
-/**
- coroutine synopsis
-
-namespace std {
-// [coroutine.traits]
-template <class R, class... ArgTypes>
- struct coroutine_traits;
-// [coroutine.handle]
-template <class Promise = void>
- struct coroutine_handle;
-// [coroutine.handle.compare]
-constexpr bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-constexpr strong_ordering operator<=>(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-// [coroutine.handle.hash]
-template <class T> struct hash;
-template <class P> struct hash<coroutine_handle<P>>;
-// [coroutine.noop]
-struct noop_coroutine_promise;
-template<> struct coroutine_handle<noop_coroutine_promise>;
-using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
-noop_coroutine_handle noop_coroutine() noexcept;
-// [coroutine.trivial.awaitables]
-struct suspend_never;
-struct suspend_always;
-} // namespace std
-
- */
-
-#include <__config>
-#include <__coroutine/coroutine_handle.h>
-#include <__coroutine/coroutine_traits.h>
-#include <__coroutine/noop_coroutine_handle.h>
-#include <__coroutine/trivial_awaitables.h>
-#include <version>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-#endif // _LIBCPP_COROUTINE
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp b/contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp
deleted file mode 100644
index 76cbaab4c3..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp
+++ /dev/null
@@ -1,47 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_CSETJMP
-#define _LIBCPP_CSETJMP
-
-/*
- csetjmp synopsis
-
-Macros:
-
- setjmp
-
-namespace std
-{
-
-Types:
-
- jmp_buf
-
-void longjmp(jmp_buf env, int val);
-
-} // std
-
-*/
-
-#include <__config>
-#include <setjmp.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-using ::jmp_buf _LIBCPP_USING_IF_EXISTS;
-using ::longjmp _LIBCPP_USING_IF_EXISTS;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CSETJMP
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/csignal b/contrib/libs/cxxsupp/libcxxmsvc/include/csignal
deleted file mode 100644
index 19091cfaa2..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/csignal
+++ /dev/null
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_CSIGNAL
-#define _LIBCPP_CSIGNAL
-
-/*
- csignal synopsis
-
-Macros:
-
- SIG_DFL
- SIG_ERR
- SIG_IGN
- SIGABRT
- SIGFPE
- SIGILL
- SIGINT
- SIGSEGV
- SIGTERM
-
-namespace std
-{
-
-Types:
-
- sig_atomic_t
-
-void (*signal(int sig, void (*func)(int)))(int);
-int raise(int sig);
-
-} // std
-
-*/
-
-#include <__config>
-#include <signal.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-using ::sig_atomic_t _LIBCPP_USING_IF_EXISTS;
-using ::signal _LIBCPP_USING_IF_EXISTS;
-using ::raise _LIBCPP_USING_IF_EXISTS;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CSIGNAL
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h b/contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h
deleted file mode 100644
index 5a8cebf65f..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_FENV_H
-#define _LIBCPP_FENV_H
-
-
-/*
- fenv.h synopsis
-
-This entire header is C99 / C++0X
-
-Macros:
-
- FE_DIVBYZERO
- FE_INEXACT
- FE_INVALID
- FE_OVERFLOW
- FE_UNDERFLOW
- FE_ALL_EXCEPT
- FE_DOWNWARD
- FE_TONEAREST
- FE_TOWARDZERO
- FE_UPWARD
- FE_DFL_ENV
-
-Types:
-
- fenv_t
- fexcept_t
-
-int feclearexcept(int excepts);
-int fegetexceptflag(fexcept_t* flagp, int excepts);
-int feraiseexcept(int excepts);
-int fesetexceptflag(const fexcept_t* flagp, int excepts);
-int fetestexcept(int excepts);
-int fegetround();
-int fesetround(int round);
-int fegetenv(fenv_t* envp);
-int feholdexcept(fenv_t* envp);
-int fesetenv(const fenv_t* envp);
-int feupdateenv(const fenv_t* envp);
-
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifdef _LIBCPP_COMPILER_MSVC
-#include Y_UCRT_INCLUDE_NEXT(fenv.h)
-#else
-#include_next <fenv.h>
-#endif
-
-#ifdef __cplusplus
-
-extern "C++" {
-
-#ifdef feclearexcept
-#undef feclearexcept
-#endif
-
-#ifdef fegetexceptflag
-#undef fegetexceptflag
-#endif
-
-
-#ifdef feraiseexcept
-#undef feraiseexcept
-#endif
-
-#ifdef fesetexceptflag
-#undef fesetexceptflag
-#endif
-
-
-#ifdef fetestexcept
-#undef fetestexcept
-#endif
-
-#ifdef fegetround
-#undef fegetround
-#endif
-
-#ifdef fesetround
-#undef fesetround
-#endif
-
-#ifdef fegetenv
-#undef fegetenv
-#endif
-
-#ifdef feholdexcept
-#undef feholdexcept
-#endif
-
-
-#ifdef fesetenv
-#undef fesetenv
-#endif
-
-#ifdef feupdateenv
-#undef feupdateenv
-#endif
-
-} // extern "C++"
-
-#endif // defined(__cplusplus)
-
-#endif // _LIBCPP_FENV_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/forward_list b/contrib/libs/cxxsupp/libcxxmsvc/include/forward_list
deleted file mode 100644
index e01a8e7189..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/forward_list
+++ /dev/null
@@ -1,1791 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_FORWARD_LIST
-#define _LIBCPP_FORWARD_LIST
-
-/*
- forward_list synopsis
-
-namespace std
-{
-
-template <class T, class Allocator = allocator<T>>
-class forward_list
-{
-public:
- typedef T value_type;
- typedef Allocator allocator_type;
-
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
-
- typedef <details> iterator;
- typedef <details> const_iterator;
-
- forward_list()
- noexcept(is_nothrow_default_constructible<allocator_type>::value);
- explicit forward_list(const allocator_type& a);
- explicit forward_list(size_type n);
- explicit forward_list(size_type n, const allocator_type& a); // C++14
- forward_list(size_type n, const value_type& v);
- forward_list(size_type n, const value_type& v, const allocator_type& a);
- template <class InputIterator>
- forward_list(InputIterator first, InputIterator last);
- template <class InputIterator>
- forward_list(InputIterator first, InputIterator last, const allocator_type& a);
- forward_list(const forward_list& x);
- forward_list(const forward_list& x, const allocator_type& a);
- forward_list(forward_list&& x)
- noexcept(is_nothrow_move_constructible<allocator_type>::value);
- forward_list(forward_list&& x, const allocator_type& a);
- forward_list(initializer_list<value_type> il);
- forward_list(initializer_list<value_type> il, const allocator_type& a);
-
- ~forward_list();
-
- forward_list& operator=(const forward_list& x);
- forward_list& operator=(forward_list&& x)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
- forward_list& operator=(initializer_list<value_type> il);
-
- template <class InputIterator>
- void assign(InputIterator first, InputIterator last);
- void assign(size_type n, const value_type& v);
- void assign(initializer_list<value_type> il);
-
- allocator_type get_allocator() const noexcept;
-
- iterator begin() noexcept;
- const_iterator begin() const noexcept;
- iterator end() noexcept;
- const_iterator end() const noexcept;
-
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
-
- iterator before_begin() noexcept;
- const_iterator before_begin() const noexcept;
- const_iterator cbefore_begin() const noexcept;
-
- bool empty() const noexcept;
- size_type max_size() const noexcept;
-
- reference front();
- const_reference front() const;
-
- template <class... Args> reference emplace_front(Args&&... args); // reference in C++17
- void push_front(const value_type& v);
- void push_front(value_type&& v);
-
- void pop_front();
-
- template <class... Args>
- iterator emplace_after(const_iterator p, Args&&... args);
- iterator insert_after(const_iterator p, const value_type& v);
- iterator insert_after(const_iterator p, value_type&& v);
- iterator insert_after(const_iterator p, size_type n, const value_type& v);
- template <class InputIterator>
- iterator insert_after(const_iterator p,
- InputIterator first, InputIterator last);
- iterator insert_after(const_iterator p, initializer_list<value_type> il);
-
- iterator erase_after(const_iterator p);
- iterator erase_after(const_iterator first, const_iterator last);
-
- void swap(forward_list& x)
- noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
-
- void resize(size_type n);
- void resize(size_type n, const value_type& v);
- void clear() noexcept;
-
- void splice_after(const_iterator p, forward_list& x);
- void splice_after(const_iterator p, forward_list&& x);
- void splice_after(const_iterator p, forward_list& x, const_iterator i);
- void splice_after(const_iterator p, forward_list&& x, const_iterator i);
- void splice_after(const_iterator p, forward_list& x,
- const_iterator first, const_iterator last);
- void splice_after(const_iterator p, forward_list&& x,
- const_iterator first, const_iterator last);
- size_type remove(const value_type& v); // void before C++20
- template <class Predicate>
- size_type remove_if(Predicate pred); // void before C++20
- size_type unique(); // void before C++20
- template <class BinaryPredicate>
- size_type unique(BinaryPredicate binary_pred); // void before C++20
- void merge(forward_list& x);
- void merge(forward_list&& x);
- template <class Compare> void merge(forward_list& x, Compare comp);
- template <class Compare> void merge(forward_list&& x, Compare comp);
- void sort();
- template <class Compare> void sort(Compare comp);
- void reverse() noexcept;
-};
-
-
-template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
- forward_list(InputIterator, InputIterator, Allocator = Allocator())
- -> forward_list<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17
-
-template <class T, class Allocator>
- bool operator==(const forward_list<T, Allocator>& x,
- const forward_list<T, Allocator>& y);
-
-template <class T, class Allocator>
- bool operator< (const forward_list<T, Allocator>& x,
- const forward_list<T, Allocator>& y);
-
-template <class T, class Allocator>
- bool operator!=(const forward_list<T, Allocator>& x,
- const forward_list<T, Allocator>& y);
-
-template <class T, class Allocator>
- bool operator> (const forward_list<T, Allocator>& x,
- const forward_list<T, Allocator>& y);
-
-template <class T, class Allocator>
- bool operator>=(const forward_list<T, Allocator>& x,
- const forward_list<T, Allocator>& y);
-
-template <class T, class Allocator>
- bool operator<=(const forward_list<T, Allocator>& x,
- const forward_list<T, Allocator>& y);
-
-template <class T, class Allocator>
- void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class T, class Allocator, class U>
- typename forward_list<T, Allocator>::size_type
- erase(forward_list<T, Allocator>& c, const U& value); // C++20
-template <class T, class Allocator, class Predicate>
- typename forward_list<T, Allocator>::size_type
- erase_if(forward_list<T, Allocator>& c, Predicate pred); // C++20
-
-} // std
-
-*/
-
-#include <__algorithm/comp.h>
-#include <__algorithm/lexicographical_compare.h>
-#include <__algorithm/min.h>
-#include <__config>
-#include <__utility/forward.h>
-#include <initializer_list>
-#include <iterator>
-#include <limits>
-#include <memory>
-#include <type_traits>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp, class _VoidPtr> struct __forward_list_node;
-template <class _NodePtr> struct __forward_begin_node;
-
-
-template <class>
-struct __forward_list_node_value_type;
-
-template <class _Tp, class _VoidPtr>
-struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > {
- typedef _Tp type;
-};
-
-template <class _NodePtr>
-struct __forward_node_traits {
-
- typedef typename remove_cv<
- typename pointer_traits<_NodePtr>::element_type>::type __node;
- typedef typename __forward_list_node_value_type<__node>::type __node_value_type;
- typedef _NodePtr __node_pointer;
- typedef __forward_begin_node<_NodePtr> __begin_node;
- typedef typename __rebind_pointer<_NodePtr, __begin_node>::type
- __begin_node_pointer;
- typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer;
-
-#if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB)
- typedef __begin_node_pointer __iter_node_pointer;
-#else
- typedef typename conditional<
- is_pointer<__void_pointer>::value,
- __begin_node_pointer,
- __node_pointer
- >::type __iter_node_pointer;
-#endif
-
- typedef typename conditional<
- is_same<__iter_node_pointer, __node_pointer>::value,
- __begin_node_pointer,
- __node_pointer
- >::type __non_iter_node_pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) {
- return __p;
- }
- _LIBCPP_INLINE_VISIBILITY
- static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) {
- return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p));
- }
-};
-
-template <class _NodePtr>
-struct __forward_begin_node
-{
- typedef _NodePtr pointer;
- typedef typename __rebind_pointer<_NodePtr, __forward_begin_node>::type __begin_node_pointer;
-
- pointer __next_;
-
- _LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
-
- _LIBCPP_INLINE_VISIBILITY
- __begin_node_pointer __next_as_begin() const {
- return static_cast<__begin_node_pointer>(__next_);
- }
-};
-
-template <class _Tp, class _VoidPtr>
-struct _LIBCPP_HIDDEN __begin_node_of
-{
- typedef __forward_begin_node<
- typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type
- > type;
-};
-
-template <class _Tp, class _VoidPtr>
-struct _LIBCPP_STANDALONE_DEBUG __forward_list_node
- : public __begin_node_of<_Tp, _VoidPtr>::type
-{
- typedef _Tp value_type;
-
- value_type __value_;
-};
-
-
-template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS forward_list;
-template<class _NodeConstPtr> class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
-
-template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __forward_list_iterator
-{
- typedef __forward_node_traits<_NodePtr> __traits;
- typedef typename __traits::__node_pointer __node_pointer;
- typedef typename __traits::__begin_node_pointer __begin_node_pointer;
- typedef typename __traits::__iter_node_pointer __iter_node_pointer;
- typedef typename __traits::__void_pointer __void_pointer;
-
- __iter_node_pointer __ptr_;
-
- _LIBCPP_INLINE_VISIBILITY
- __begin_node_pointer __get_begin() const {
- return static_cast<__begin_node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
- _LIBCPP_INLINE_VISIBILITY
- __node_pointer __get_unsafe_node_pointer() const {
- return static_cast<__node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_iterator(__begin_node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
-
- template<class, class> friend class _LIBCPP_TEMPLATE_VIS forward_list;
- template<class> friend class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
-
-public:
- typedef forward_iterator_tag iterator_category;
- typedef typename __traits::__node_value_type value_type;
- typedef value_type& reference;
- typedef typename pointer_traits<__node_pointer>::difference_type
- difference_type;
- typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
-
- _LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __get_unsafe_node_pointer()->__value_;}
- _LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__value_);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_iterator& operator++()
- {
- __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
- return *this;
- }
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_iterator operator++(int)
- {
- __forward_list_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(const __forward_list_iterator& __x,
- const __forward_list_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const __forward_list_iterator& __x,
- const __forward_list_iterator& __y)
- {return !(__x == __y);}
-};
-
-template <class _NodeConstPtr>
-class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator
-{
- static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), "");
- typedef _NodeConstPtr _NodePtr;
-
- typedef __forward_node_traits<_NodePtr> __traits;
- typedef typename __traits::__node __node;
- typedef typename __traits::__node_pointer __node_pointer;
- typedef typename __traits::__begin_node_pointer __begin_node_pointer;
- typedef typename __traits::__iter_node_pointer __iter_node_pointer;
- typedef typename __traits::__void_pointer __void_pointer;
-
- __iter_node_pointer __ptr_;
-
- __begin_node_pointer __get_begin() const {
- return static_cast<__begin_node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
- __node_pointer __get_unsafe_node_pointer() const {
- return static_cast<__node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT
- : __ptr_(nullptr) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_const_iterator(__begin_node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_const_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
-
-
- template<class, class> friend class forward_list;
-
-public:
- typedef forward_iterator_tag iterator_category;
- typedef typename __traits::__node_value_type value_type;
- typedef const value_type& reference;
- typedef typename pointer_traits<__node_pointer>::difference_type
- difference_type;
- typedef typename __rebind_pointer<__node_pointer, const value_type>::type
- pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
- : __ptr_(__p.__ptr_) {}
-
- _LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __get_unsafe_node_pointer()->__value_;}
- _LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(
- __get_unsafe_node_pointer()->__value_);}
-
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_const_iterator& operator++()
- {
- __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
- return *this;
- }
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_const_iterator operator++(int)
- {
- __forward_list_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(const __forward_list_const_iterator& __x,
- const __forward_list_const_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const __forward_list_const_iterator& __x,
- const __forward_list_const_iterator& __y)
- {return !(__x == __y);}
-};
-
-template <class _Tp, class _Alloc>
-class __forward_list_base
-{
-protected:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
-
- typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
- typedef __forward_list_node<value_type, void_pointer> __node;
- typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
- typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
- typedef typename __node_traits::pointer __node_pointer;
-
- typedef typename __rebind_alloc_helper<
- allocator_traits<allocator_type>, __begin_node
- >::type __begin_node_allocator;
- typedef typename allocator_traits<__begin_node_allocator>::pointer
- __begin_node_pointer;
-
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
-
- __compressed_pair<__begin_node, __node_allocator> __before_begin_;
-
- _LIBCPP_INLINE_VISIBILITY
- __begin_node_pointer __before_begin() _NOEXCEPT
- {return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());}
- _LIBCPP_INLINE_VISIBILITY
- __begin_node_pointer __before_begin() const _NOEXCEPT
- {return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));}
-
- _LIBCPP_INLINE_VISIBILITY
- __node_allocator& __alloc() _NOEXCEPT
- {return __before_begin_.second();}
- _LIBCPP_INLINE_VISIBILITY
- const __node_allocator& __alloc() const _NOEXCEPT
- {return __before_begin_.second();}
-
- typedef __forward_list_iterator<__node_pointer> iterator;
- typedef __forward_list_const_iterator<__node_pointer> const_iterator;
-
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_base()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- : __before_begin_(__begin_node(), __default_init_tag()) {}
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_base(const allocator_type& __a)
- : __before_begin_(__begin_node(), __node_allocator(__a)) {}
- _LIBCPP_INLINE_VISIBILITY
- explicit __forward_list_base(const __node_allocator& __a)
- : __before_begin_(__begin_node(), __a) {}
-#ifndef _LIBCPP_CXX03_LANG
-public:
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
- _LIBCPP_INLINE_VISIBILITY
- __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
-#endif // _LIBCPP_CXX03_LANG
-
-private:
- __forward_list_base(const __forward_list_base&);
- __forward_list_base& operator=(const __forward_list_base&);
-
-public:
- ~__forward_list_base();
-
-protected:
- _LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __forward_list_base& __x)
- {__copy_assign_alloc(__x, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__forward_list_base& __x)
- _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__x, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- void swap(__forward_list_base& __x)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
-#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value);
-#endif
-protected:
- void clear() _NOEXCEPT;
-
-private:
- _LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __forward_list_base&, false_type) {}
- _LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __forward_list_base& __x, true_type)
- {
- if (__alloc() != __x.__alloc())
- clear();
- __alloc() = __x.__alloc();
- }
-
- _LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT
- {}
- _LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__forward_list_base& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {__alloc() = _VSTD::move(__x.__alloc());}
-};
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-inline
-__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
- : __before_begin_(_VSTD::move(__x.__before_begin_))
-{
- __x.__before_begin()->__next_ = nullptr;
-}
-
-template <class _Tp, class _Alloc>
-inline
-__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
- const allocator_type& __a)
- : __before_begin_(__begin_node(), __node_allocator(__a))
-{
- if (__alloc() == __x.__alloc())
- {
- __before_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
- }
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
-{
- clear();
-}
-
-template <class _Tp, class _Alloc>
-inline
-void
-__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
-#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
-#endif
-{
- _VSTD::__swap_allocator(__alloc(), __x.__alloc(),
- integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
- using _VSTD::swap;
- swap(__before_begin()->__next_, __x.__before_begin()->__next_);
-}
-
-template <class _Tp, class _Alloc>
-void
-__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
-{
- __node_allocator& __a = __alloc();
- for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
- {
- __node_pointer __next = __p->__next_;
- __node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
- __node_traits::deallocate(__a, __p, 1);
- __p = __next;
- }
- __before_begin()->__next_ = nullptr;
-}
-
-template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS forward_list
- : private __forward_list_base<_Tp, _Alloc>
-{
- typedef __forward_list_base<_Tp, _Alloc> base;
- typedef typename base::__node_allocator __node_allocator;
- typedef typename base::__node __node;
- typedef typename base::__node_traits __node_traits;
- typedef typename base::__node_pointer __node_pointer;
- typedef typename base::__begin_node_pointer __begin_node_pointer;
-
-public:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
-
- typedef typename base::iterator iterator;
- typedef typename base::const_iterator const_iterator;
-#if _LIBCPP_STD_VER > 17
- typedef size_type __remove_return_type;
-#else
- typedef void __remove_return_type;
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- forward_list()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- {} // = default;
- _LIBCPP_INLINE_VISIBILITY
- explicit forward_list(const allocator_type& __a);
- explicit forward_list(size_type __n);
-#if _LIBCPP_STD_VER > 11
- explicit forward_list(size_type __n, const allocator_type& __a);
-#endif
- forward_list(size_type __n, const value_type& __v);
-
- template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
- forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a)
- {
- insert_after(cbefore_begin(), __n, __v);
- }
-
- template <class _InputIterator>
- forward_list(_InputIterator __f, _InputIterator __l,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type* = nullptr);
- template <class _InputIterator>
- forward_list(_InputIterator __f, _InputIterator __l,
- const allocator_type& __a,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type* = nullptr);
- forward_list(const forward_list& __x);
- forward_list(const forward_list& __x, const __identity_t<allocator_type>& __a);
-
- forward_list& operator=(const forward_list& __x);
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- forward_list(forward_list&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
- : base(_VSTD::move(__x)) {}
- forward_list(forward_list&& __x, const __identity_t<allocator_type>& __a);
-
- forward_list(initializer_list<value_type> __il);
- forward_list(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_INLINE_VISIBILITY
- forward_list& operator=(forward_list&& __x)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
-
- _LIBCPP_INLINE_VISIBILITY
- forward_list& operator=(initializer_list<value_type> __il);
-
- _LIBCPP_INLINE_VISIBILITY
- void assign(initializer_list<value_type> __il);
-#endif // _LIBCPP_CXX03_LANG
-
- // ~forward_list() = default;
-
- template <class _InputIterator>
- typename enable_if
- <
- __is_cpp17_input_iterator<_InputIterator>::value,
- void
- >::type
- assign(_InputIterator __f, _InputIterator __l);
- void assign(size_type __n, const value_type& __v);
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(base::__alloc());}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT
- {return iterator(base::__before_begin()->__next_);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin()->__next_);}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT
- {return iterator(nullptr);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT
- {return const_iterator(nullptr);}
-
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT
- {return const_iterator(base::__before_begin()->__next_);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT
- {return const_iterator(nullptr);}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator before_begin() _NOEXCEPT
- {return iterator(base::__before_begin());}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator before_begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin());}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbefore_begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT
- {return base::__before_begin()->__next_ == nullptr;}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {
- return _VSTD::min<size_type>(
- __node_traits::max_size(base::__alloc()),
- numeric_limits<difference_type>::max());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- reference front() {return base::__before_begin()->__next_->__value_;}
- _LIBCPP_INLINE_VISIBILITY
- const_reference front() const {return base::__before_begin()->__next_->__value_;}
-
-#ifndef _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER > 14
- template <class... _Args> reference emplace_front(_Args&&... __args);
-#else
- template <class... _Args> void emplace_front(_Args&&... __args);
-#endif
- void push_front(value_type&& __v);
-#endif // _LIBCPP_CXX03_LANG
- void push_front(const value_type& __v);
-
- void pop_front();
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- iterator emplace_after(const_iterator __p, _Args&&... __args);
-
- iterator insert_after(const_iterator __p, value_type&& __v);
- iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
- {return insert_after(__p, __il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
- iterator insert_after(const_iterator __p, const value_type& __v);
- iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if
- <
- __is_cpp17_input_iterator<_InputIterator>::value,
- iterator
- >::type
- insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
-
- iterator erase_after(const_iterator __p);
- iterator erase_after(const_iterator __f, const_iterator __l);
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(forward_list& __x)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
-#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
-#endif
- {base::swap(__x);}
-
- void resize(size_type __n);
- void resize(size_type __n, const value_type& __v);
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {base::clear();}
-
- _LIBCPP_INLINE_VISIBILITY
- void splice_after(const_iterator __p, forward_list&& __x);
- _LIBCPP_INLINE_VISIBILITY
- void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
- _LIBCPP_INLINE_VISIBILITY
- void splice_after(const_iterator __p, forward_list&& __x,
- const_iterator __f, const_iterator __l);
- void splice_after(const_iterator __p, forward_list& __x);
- void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
- void splice_after(const_iterator __p, forward_list& __x,
- const_iterator __f, const_iterator __l);
- __remove_return_type remove(const value_type& __v);
- template <class _Predicate> __remove_return_type remove_if(_Predicate __pred);
- _LIBCPP_INLINE_VISIBILITY
- __remove_return_type unique() {return unique(__equal_to<value_type>());}
- template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
- template <class _Compare>
- _LIBCPP_INLINE_VISIBILITY
- void merge(forward_list&& __x, _Compare __comp)
- {merge(__x, _VSTD::move(__comp));}
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void merge(forward_list& __x) {merge(__x, __less<value_type>());}
- template <class _Compare> void merge(forward_list& __x, _Compare __comp);
- _LIBCPP_INLINE_VISIBILITY
- void sort() {sort(__less<value_type>());}
- template <class _Compare> _LIBCPP_INLINE_VISIBILITY void sort(_Compare __comp);
- void reverse() _NOEXCEPT;
-
-private:
-
-#ifndef _LIBCPP_CXX03_LANG
- void __move_assign(forward_list& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- void __move_assign(forward_list& __x, false_type);
-#endif // _LIBCPP_CXX03_LANG
-
- template <class _Compare>
- static
- __node_pointer
- __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp);
-
- template <class _Compare>
- static
- __node_pointer
- __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
-};
-
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(_InputIterator, _InputIterator)
- -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(_InputIterator, _InputIterator, _Alloc)
- -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
-#endif
-
-template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
- : base(__a)
-{
-}
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n)
-{
- if (__n > 0)
- {
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
- for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n,
- __p = __p->__next_as_begin())
- {
- __h.reset(__node_traits::allocate(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
- __h->__next_ = nullptr;
- __p->__next_ = __h.release();
- }
- }
-}
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n,
- const allocator_type& __base_alloc)
- : base ( __base_alloc )
-{
- if (__n > 0)
- {
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
- for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n,
- __p = __p->__next_as_begin())
- {
- __h.reset(__node_traits::allocate(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
- __h->__next_ = nullptr;
- __p->__next_ = __h.release();
- }
- }
-}
-#endif
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
-{
- insert_after(cbefore_begin(), __n, __v);
-}
-
-template <class _Tp, class _Alloc>
-template <class _InputIterator>
-forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type*)
-{
- insert_after(cbefore_begin(), __f, __l);
-}
-
-template <class _Tp, class _Alloc>
-template <class _InputIterator>
-forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- const allocator_type& __a,
- typename enable_if<
- __is_cpp17_input_iterator<_InputIterator>::value
- >::type*)
- : base(__a)
-{
- insert_after(cbefore_begin(), __f, __l);
-}
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x)
- : base(
- __node_traits::select_on_container_copy_construction(__x.__alloc())) {
- insert_after(cbefore_begin(), __x.begin(), __x.end());
-}
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
- const __identity_t<allocator_type>& __a)
- : base(__a)
-{
- insert_after(cbefore_begin(), __x.begin(), __x.end());
-}
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
-{
- if (this != _VSTD::addressof(__x))
- {
- base::__copy_assign_alloc(__x);
- assign(__x.begin(), __x.end());
- }
- return *this;
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
- const __identity_t<allocator_type>& __a)
- : base(_VSTD::move(__x), __a)
-{
- if (base::__alloc() != __x.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
- }
-}
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
-{
- insert_after(cbefore_begin(), __il.begin(), __il.end());
-}
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
- const allocator_type& __a)
- : base(__a)
-{
- insert_after(cbefore_begin(), __il.begin(), __il.end());
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- clear();
- base::__move_assign_alloc(__x);
- base::__before_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
-{
- if (base::__alloc() == __x.__alloc())
- __move_assign(__x, true_type());
- else
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__x.begin()), _Ip(__x.end()));
- }
-}
-
-template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
-{
- __move_assign(__x, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
-{
- assign(__il.begin(), __il.end());
- return *this;
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-template <class _InputIterator>
-typename enable_if
-<
- __is_cpp17_input_iterator<_InputIterator>::value,
- void
->::type
-forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
-{
- iterator __i = before_begin();
- iterator __j = _VSTD::next(__i);
- iterator __e = end();
- for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
- *__j = *__f;
- if (__j == __e)
- insert_after(__i, __f, __l);
- else
- erase_after(__i, __e);
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
-{
- iterator __i = before_begin();
- iterator __j = _VSTD::next(__i);
- iterator __e = end();
- for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
- *__j = __v;
- if (__j == __e)
- insert_after(__i, __n, __v);
- else
- erase_after(__i, __e);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-inline
-void
-forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
-{
- assign(__il.begin(), __il.end());
-}
-
-template <class _Tp, class _Alloc>
-template <class... _Args>
-#if _LIBCPP_STD_VER > 14
-typename forward_list<_Tp, _Alloc>::reference
-#else
-void
-#endif
-forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
-{
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
- _VSTD::forward<_Args>(__args)...);
- __h->__next_ = base::__before_begin()->__next_;
- base::__before_begin()->__next_ = __h.release();
-#if _LIBCPP_STD_VER > 14
- return base::__before_begin()->__next_->__value_;
-#endif
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
-{
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
- __h->__next_ = base::__before_begin()->__next_;
- base::__before_begin()->__next_ = __h.release();
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
-{
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
- __h->__next_ = base::__before_begin()->__next_;
- base::__before_begin()->__next_ = __h.release();
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::pop_front()
-{
- __node_allocator& __a = base::__alloc();
- __node_pointer __p = base::__before_begin()->__next_;
- base::__before_begin()->__next_ = __p->__next_;
- __node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
- __node_traits::deallocate(__a, __p, 1);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-template <class... _Args>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
- _VSTD::forward<_Args>(__args)...);
- __h->__next_ = __r->__next_;
- __r->__next_ = __h.release();
- return iterator(__r->__next_);
-}
-
-template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
- __h->__next_ = __r->__next_;
- __r->__next_ = __h.release();
- return iterator(__r->__next_);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
- __h->__next_ = __r->__next_;
- __r->__next_ = __h.release();
- return iterator(__r->__next_);
-}
-
-template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
- const value_type& __v)
-{
- __begin_node_pointer __r = __p.__get_begin();
- if (__n > 0)
- {
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
- __node_pointer __first = __h.release();
- __node_pointer __last = __first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, __last = __last->__next_)
- {
- __h.reset(__node_traits::allocate(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
- __last->__next_ = __h.release();
- }
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (__first != nullptr)
- {
- __node_pointer __next = __first->__next_;
- __node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
- __node_traits::deallocate(__a, __first, 1);
- __first = __next;
- }
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- __last->__next_ = __r->__next_;
- __r->__next_ = __first;
- __r = static_cast<__begin_node_pointer>(__last);
- }
- return iterator(__r);
-}
-
-template <class _Tp, class _Alloc>
-template <class _InputIterator>
-typename enable_if
-<
- __is_cpp17_input_iterator<_InputIterator>::value,
- typename forward_list<_Tp, _Alloc>::iterator
->::type
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
- _InputIterator __f, _InputIterator __l)
-{
- __begin_node_pointer __r = __p.__get_begin();
- if (__f != __l)
- {
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
- __node_pointer __first = __h.release();
- __node_pointer __last = __first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
- {
- __h.reset(__node_traits::allocate(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
- __last->__next_ = __h.release();
- }
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (__first != nullptr)
- {
- __node_pointer __next = __first->__next_;
- __node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
- __node_traits::deallocate(__a, __first, 1);
- __first = __next;
- }
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- __last->__next_ = __r->__next_;
- __r->__next_ = __first;
- __r = static_cast<__begin_node_pointer>(__last);
- }
- return iterator(__r);
-}
-
-template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
-{
- __begin_node_pointer __p = __f.__get_begin();
- __node_pointer __n = __p->__next_;
- __p->__next_ = __n->__next_;
- __node_allocator& __a = base::__alloc();
- __node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
- __node_traits::deallocate(__a, __n, 1);
- return iterator(__p->__next_);
-}
-
-template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
-{
- __node_pointer __e = __l.__get_unsafe_node_pointer();
- if (__f != __l)
- {
- __begin_node_pointer __bp = __f.__get_begin();
-
- __node_pointer __n = __bp->__next_;
- if (__n != __e)
- {
- __bp->__next_ = __e;
- __node_allocator& __a = base::__alloc();
- do
- {
- __node_pointer __tmp = __n->__next_;
- __node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
- __node_traits::deallocate(__a, __n, 1);
- __n = __tmp;
- } while (__n != __e);
- }
- }
- return iterator(__e);
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::resize(size_type __n)
-{
- size_type __sz = 0;
- iterator __p = before_begin();
- iterator __i = begin();
- iterator __e = end();
- for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
- ;
- if (__i != __e)
- erase_after(__p, __e);
- else
- {
- __n -= __sz;
- if (__n > 0)
- {
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
- for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n,
- __ptr = __ptr->__next_as_begin())
- {
- __h.reset(__node_traits::allocate(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
- __h->__next_ = nullptr;
- __ptr->__next_ = __h.release();
- }
- }
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
-{
- size_type __sz = 0;
- iterator __p = before_begin();
- iterator __i = begin();
- iterator __e = end();
- for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
- ;
- if (__i != __e)
- erase_after(__p, __e);
- else
- {
- __n -= __sz;
- if (__n > 0)
- {
- __node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _Dp;
- unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
- for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n,
- __ptr = __ptr->__next_as_begin())
- {
- __h.reset(__node_traits::allocate(__a, 1));
- __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
- __h->__next_ = nullptr;
- __ptr->__next_ = __h.release();
- }
- }
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& __x)
-{
- if (!__x.empty())
- {
- if (__p.__get_begin()->__next_ != nullptr)
- {
- const_iterator __lm1 = __x.before_begin();
- while (__lm1.__get_begin()->__next_ != nullptr)
- ++__lm1;
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- }
- __p.__get_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& /*__other*/,
- const_iterator __i)
-{
- const_iterator __lm1 = _VSTD::next(__i);
- if (__p != __i && __p != __lm1)
- {
- __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_;
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer();
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& /*__other*/,
- const_iterator __f, const_iterator __l)
-{
- if (__f != __l && __p != __f)
- {
- const_iterator __lm1 = __f;
- while (__lm1.__get_begin()->__next_ != __l.__get_begin())
- ++__lm1;
- if (__f != __lm1)
- {
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- __p.__get_begin()->__next_ = __f.__get_begin()->__next_;
- __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer();
- }
- }
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x)
-{
- splice_after(__p, __x);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x,
- const_iterator __i)
-{
- splice_after(__p, __x, __i);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x,
- const_iterator __f, const_iterator __l)
-{
- splice_after(__p, __x, __f, __l);
-}
-
-template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::remove(const value_type& __v)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- const iterator __e = end();
- for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
- {
- if (__i.__get_begin()->__next_->__value_ == __v)
- {
- ++__count_removed;
- iterator __j = _VSTD::next(__i, 2);
- for (; __j != __e && *__j == __v; ++__j)
- ++__count_removed;
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- if (__j == __e)
- break;
- __i = __j;
- }
- else
- ++__i;
- }
-
- return (__remove_return_type) __count_removed;
-}
-
-template <class _Tp, class _Alloc>
-template <class _Predicate>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- const iterator __e = end();
- for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
- {
- if (__pred(__i.__get_begin()->__next_->__value_))
- {
- ++__count_removed;
- iterator __j = _VSTD::next(__i, 2);
- for (; __j != __e && __pred(*__j); ++__j)
- ++__count_removed;
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- if (__j == __e)
- break;
- __i = __j;
- }
- else
- ++__i;
- }
-
- return (__remove_return_type) __count_removed;
-}
-
-template <class _Tp, class _Alloc>
-template <class _BinaryPredicate>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- iterator __j = _VSTD::next(__i);
- for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
- ++__count_removed;
- if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- __i = __j;
- }
-
- return (__remove_return_type) __count_removed;
-}
-
-template <class _Tp, class _Alloc>
-template <class _Compare>
-void
-forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
-{
- if (this != _VSTD::addressof(__x))
- {
- base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_,
- __x.__before_begin()->__next_,
- __comp);
- __x.__before_begin()->__next_ = nullptr;
- }
-}
-
-template <class _Tp, class _Alloc>
-template <class _Compare>
-typename forward_list<_Tp, _Alloc>::__node_pointer
-forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
- _Compare& __comp)
-{
- if (__f1 == nullptr)
- return __f2;
- if (__f2 == nullptr)
- return __f1;
- __node_pointer __r;
- if (__comp(__f2->__value_, __f1->__value_))
- {
- __node_pointer __t = __f2;
- while (__t->__next_ != nullptr &&
- __comp(__t->__next_->__value_, __f1->__value_))
- __t = __t->__next_;
- __r = __f2;
- __f2 = __t->__next_;
- __t->__next_ = __f1;
- }
- else
- __r = __f1;
- __node_pointer __p = __f1;
- __f1 = __f1->__next_;
- while (__f1 != nullptr && __f2 != nullptr)
- {
- if (__comp(__f2->__value_, __f1->__value_))
- {
- __node_pointer __t = __f2;
- while (__t->__next_ != nullptr &&
- __comp(__t->__next_->__value_, __f1->__value_))
- __t = __t->__next_;
- __p->__next_ = __f2;
- __f2 = __t->__next_;
- __t->__next_ = __f1;
- }
- __p = __f1;
- __f1 = __f1->__next_;
- }
- if (__f2 != nullptr)
- __p->__next_ = __f2;
- return __r;
-}
-
-template <class _Tp, class _Alloc>
-template <class _Compare>
-inline
-void
-forward_list<_Tp, _Alloc>::sort(_Compare __comp)
-{
- base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
- _VSTD::distance(begin(), end()), __comp);
-}
-
-template <class _Tp, class _Alloc>
-template <class _Compare>
-typename forward_list<_Tp, _Alloc>::__node_pointer
-forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
- _Compare& __comp)
-{
- switch (__sz)
- {
- case 0:
- case 1:
- return __f1;
- case 2:
- if (__comp(__f1->__next_->__value_, __f1->__value_))
- {
- __node_pointer __t = __f1->__next_;
- __t->__next_ = __f1;
- __f1->__next_ = nullptr;
- __f1 = __t;
- }
- return __f1;
- }
- difference_type __sz1 = __sz / 2;
- difference_type __sz2 = __sz - __sz1;
- __node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer();
- __node_pointer __f2 = __t->__next_;
- __t->__next_ = nullptr;
- return __merge(__sort(__f1, __sz1, __comp),
- __sort(__f2, __sz2, __comp), __comp);
-}
-
-template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
-{
- __node_pointer __p = base::__before_begin()->__next_;
- if (__p != nullptr)
- {
- __node_pointer __f = __p->__next_;
- __p->__next_ = nullptr;
- while (__f != nullptr)
- {
- __node_pointer __t = __f->__next_;
- __f->__next_ = __p;
- __p = __f;
- __f = __t;
- }
- base::__before_begin()->__next_ = __p;
- }
-}
-
-template <class _Tp, class _Alloc>
-bool operator==(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- typedef forward_list<_Tp, _Alloc> _Cp;
- typedef typename _Cp::const_iterator _Ip;
- _Ip __ix = __x.begin();
- _Ip __ex = __x.end();
- _Ip __iy = __y.begin();
- _Ip __ey = __y.end();
- for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
- if (!(*__ix == *__iy))
- return false;
- return (__ix == __ex) == (__iy == __ey);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator!=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator< (const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator> (const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return __y < __x;
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator>=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__x < __y);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator<=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__y < __x);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Tp, class _Allocator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename forward_list<_Tp, _Allocator>::size_type
- erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) {
- return __c.remove_if(__pred);
-}
-
-template <class _Tp, class _Allocator, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
- typename forward_list<_Tp, _Allocator>::size_type
- erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) {
- return _VSTD::erase_if(__c, [&](auto& __elem) { return __elem == __v; });
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_FORWARD_LIST
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h b/contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h
deleted file mode 100644
index 5873e3f647..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_INTTYPES_H
-// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
-// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
-// case the header guard macro is defined.
-#if !defined(_AIX) || !defined(_STD_TYPES_T)
-#define _LIBCPP_INTTYPES_H
-#endif // _STD_TYPES_T
-
-/*
- inttypes.h synopsis
-
-This entire header is C99 / C++0X
-
-#include <stdint.h> // <cinttypes> includes <cstdint>
-
-Macros:
-
- PRId8
- PRId16
- PRId32
- PRId64
-
- PRIdLEAST8
- PRIdLEAST16
- PRIdLEAST32
- PRIdLEAST64
-
- PRIdFAST8
- PRIdFAST16
- PRIdFAST32
- PRIdFAST64
-
- PRIdMAX
- PRIdPTR
-
- PRIi8
- PRIi16
- PRIi32
- PRIi64
-
- PRIiLEAST8
- PRIiLEAST16
- PRIiLEAST32
- PRIiLEAST64
-
- PRIiFAST8
- PRIiFAST16
- PRIiFAST32
- PRIiFAST64
-
- PRIiMAX
- PRIiPTR
-
- PRIo8
- PRIo16
- PRIo32
- PRIo64
-
- PRIoLEAST8
- PRIoLEAST16
- PRIoLEAST32
- PRIoLEAST64
-
- PRIoFAST8
- PRIoFAST16
- PRIoFAST32
- PRIoFAST64
-
- PRIoMAX
- PRIoPTR
-
- PRIu8
- PRIu16
- PRIu32
- PRIu64
-
- PRIuLEAST8
- PRIuLEAST16
- PRIuLEAST32
- PRIuLEAST64
-
- PRIuFAST8
- PRIuFAST16
- PRIuFAST32
- PRIuFAST64
-
- PRIuMAX
- PRIuPTR
-
- PRIx8
- PRIx16
- PRIx32
- PRIx64
-
- PRIxLEAST8
- PRIxLEAST16
- PRIxLEAST32
- PRIxLEAST64
-
- PRIxFAST8
- PRIxFAST16
- PRIxFAST32
- PRIxFAST64
-
- PRIxMAX
- PRIxPTR
-
- PRIX8
- PRIX16
- PRIX32
- PRIX64
-
- PRIXLEAST8
- PRIXLEAST16
- PRIXLEAST32
- PRIXLEAST64
-
- PRIXFAST8
- PRIXFAST16
- PRIXFAST32
- PRIXFAST64
-
- PRIXMAX
- PRIXPTR
-
- SCNd8
- SCNd16
- SCNd32
- SCNd64
-
- SCNdLEAST8
- SCNdLEAST16
- SCNdLEAST32
- SCNdLEAST64
-
- SCNdFAST8
- SCNdFAST16
- SCNdFAST32
- SCNdFAST64
-
- SCNdMAX
- SCNdPTR
-
- SCNi8
- SCNi16
- SCNi32
- SCNi64
-
- SCNiLEAST8
- SCNiLEAST16
- SCNiLEAST32
- SCNiLEAST64
-
- SCNiFAST8
- SCNiFAST16
- SCNiFAST32
- SCNiFAST64
-
- SCNiMAX
- SCNiPTR
-
- SCNo8
- SCNo16
- SCNo32
- SCNo64
-
- SCNoLEAST8
- SCNoLEAST16
- SCNoLEAST32
- SCNoLEAST64
-
- SCNoFAST8
- SCNoFAST16
- SCNoFAST32
- SCNoFAST64
-
- SCNoMAX
- SCNoPTR
-
- SCNu8
- SCNu16
- SCNu32
- SCNu64
-
- SCNuLEAST8
- SCNuLEAST16
- SCNuLEAST32
- SCNuLEAST64
-
- SCNuFAST8
- SCNuFAST16
- SCNuFAST32
- SCNuFAST64
-
- SCNuMAX
- SCNuPTR
-
- SCNx8
- SCNx16
- SCNx32
- SCNx64
-
- SCNxLEAST8
- SCNxLEAST16
- SCNxLEAST32
- SCNxLEAST64
-
- SCNxFAST8
- SCNxFAST16
- SCNxFAST32
- SCNxFAST64
-
- SCNxMAX
- SCNxPTR
-
-Types:
-
- imaxdiv_t
-
-intmax_t imaxabs(intmax_t j);
-imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
-intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
-uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
-intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
-uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed
- for C++11 unless __STDC_FORMAT_MACROS is defined
-*/
-#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
-# define __STDC_FORMAT_MACROS
-#endif
-
-#ifdef _LIBCPP_COMPILER_MSVC
-#include Y_UCRT_INCLUDE_NEXT(inttypes.h)
-#else
-#include_next <inttypes.h>
-#endif
-
-#ifdef __cplusplus
-
-#include <stdint.h>
-
-#undef imaxabs
-#undef imaxdiv
-
-#endif // __cplusplus
-
-#endif // _LIBCPP_INTTYPES_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/iostream b/contrib/libs/cxxsupp/libcxxmsvc/include/iostream
deleted file mode 100644
index dbabf3ad32..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/iostream
+++ /dev/null
@@ -1,89 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_IOSTREAM
-#define _LIBCPP_IOSTREAM
-
-/*
- iostream synopsis
-
-#include <ios>
-#include <istream>
-#include <ostream>
-#include <streambuf>
-
-namespace std {
-
-extern istream cin;
-extern ostream cout;
-extern ostream cerr;
-extern ostream clog;
-extern wistream wcin;
-extern wostream wcout;
-extern wostream wcerr;
-extern wostream wclog;
-
-} // std
-
-*/
-
-#include <__config>
-#include <ios>
-#include <istream>
-#include <ostream>
-#include <streambuf>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if defined(_MSC_VER) && !defined(__clang__)
-extern _LIBCPP_FUNC_VIS istream& cin;
-#else
-extern _LIBCPP_FUNC_VIS istream cin;
-#endif
-#if defined(_MSC_VER) && !defined(__clang__)
-extern _LIBCPP_FUNC_VIS ostream& cout;
-#else
-extern _LIBCPP_FUNC_VIS ostream cout;
-#endif
-#if defined(_MSC_VER) && !defined(__clang__)
-extern _LIBCPP_FUNC_VIS ostream& cerr;
-extern _LIBCPP_FUNC_VIS ostream& clog;
-#else
-extern _LIBCPP_FUNC_VIS ostream cerr;
-extern _LIBCPP_FUNC_VIS ostream clog;
-#endif
-
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#if defined(_MSC_VER) && !defined(__clang__)
-extern _LIBCPP_FUNC_VIS wistream& wcin;
-#else
-extern _LIBCPP_FUNC_VIS wistream wcin;
-#endif
-#if defined(_MSC_VER) && !defined(__clang__)
-extern _LIBCPP_FUNC_VIS wostream& wcout;
-#else
-extern _LIBCPP_FUNC_VIS wostream wcout;
-#endif
-#if defined(_MSC_VER) && !defined(__clang__)
-extern _LIBCPP_FUNC_VIS wostream& wcerr;
-extern _LIBCPP_FUNC_VIS wostream& wclog;
-#else
-extern _LIBCPP_FUNC_VIS wostream wcerr;
-extern _LIBCPP_FUNC_VIS wostream wclog;
-#endif
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_IOSTREAM
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/list b/contrib/libs/cxxsupp/libcxxmsvc/include/list
deleted file mode 100644
index b1f6c57007..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/list
+++ /dev/null
@@ -1,2422 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_LIST
-#define _LIBCPP_LIST
-
-/*
- list synopsis
-
-namespace std
-{
-
-template <class T, class Alloc = allocator<T> >
-class list
-{
-public:
-
- // types:
- typedef T value_type;
- typedef Alloc allocator_type;
- typedef typename allocator_type::reference reference;
- typedef typename allocator_type::const_reference const_reference;
- typedef typename allocator_type::pointer pointer;
- typedef typename allocator_type::const_pointer const_pointer;
- typedef implementation-defined iterator;
- typedef implementation-defined const_iterator;
- typedef implementation-defined size_type;
- typedef implementation-defined difference_type;
- typedef reverse_iterator<iterator> reverse_iterator;
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
-
- list()
- noexcept(is_nothrow_default_constructible<allocator_type>::value);
- explicit list(const allocator_type& a);
- explicit list(size_type n);
- explicit list(size_type n, const allocator_type& a); // C++14
- list(size_type n, const value_type& value);
- list(size_type n, const value_type& value, const allocator_type& a);
- template <class Iter>
- list(Iter first, Iter last);
- template <class Iter>
- list(Iter first, Iter last, const allocator_type& a);
- list(const list& x);
- list(const list&, const allocator_type& a);
- list(list&& x)
- noexcept(is_nothrow_move_constructible<allocator_type>::value);
- list(list&&, const allocator_type& a);
- list(initializer_list<value_type>);
- list(initializer_list<value_type>, const allocator_type& a);
-
- ~list();
-
- list& operator=(const list& x);
- list& operator=(list&& x)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
- list& operator=(initializer_list<value_type>);
- template <class Iter>
- void assign(Iter first, Iter last);
- void assign(size_type n, const value_type& t);
- void assign(initializer_list<value_type>);
-
- allocator_type get_allocator() const noexcept;
-
- iterator begin() noexcept;
- const_iterator begin() const noexcept;
- iterator end() noexcept;
- const_iterator end() const noexcept;
- reverse_iterator rbegin() noexcept;
- const_reverse_iterator rbegin() const noexcept;
- reverse_iterator rend() noexcept;
- const_reverse_iterator rend() const noexcept;
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
- const_reverse_iterator crbegin() const noexcept;
- const_reverse_iterator crend() const noexcept;
-
- reference front();
- const_reference front() const;
- reference back();
- const_reference back() const;
-
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- template <class... Args>
- reference emplace_front(Args&&... args); // reference in C++17
- void pop_front();
- template <class... Args>
- reference emplace_back(Args&&... args); // reference in C++17
- void pop_back();
- void push_front(const value_type& x);
- void push_front(value_type&& x);
- void push_back(const value_type& x);
- void push_back(value_type&& x);
- template <class... Args>
- iterator emplace(const_iterator position, Args&&... args);
- iterator insert(const_iterator position, const value_type& x);
- iterator insert(const_iterator position, value_type&& x);
- iterator insert(const_iterator position, size_type n, const value_type& x);
- template <class Iter>
- iterator insert(const_iterator position, Iter first, Iter last);
- iterator insert(const_iterator position, initializer_list<value_type> il);
-
- iterator erase(const_iterator position);
- iterator erase(const_iterator position, const_iterator last);
-
- void resize(size_type sz);
- void resize(size_type sz, const value_type& c);
-
- void swap(list&)
- noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
- void clear() noexcept;
-
- void splice(const_iterator position, list& x);
- void splice(const_iterator position, list&& x);
- void splice(const_iterator position, list& x, const_iterator i);
- void splice(const_iterator position, list&& x, const_iterator i);
- void splice(const_iterator position, list& x, const_iterator first,
- const_iterator last);
- void splice(const_iterator position, list&& x, const_iterator first,
- const_iterator last);
-
- size_type remove(const value_type& value); // void before C++20
- template <class Pred>
- size_type remove_if(Pred pred); // void before C++20
- size_type unique(); // void before C++20
- template <class BinaryPredicate>
- size_type unique(BinaryPredicate binary_pred); // void before C++20
- void merge(list& x);
- void merge(list&& x);
- template <class Compare>
- void merge(list& x, Compare comp);
- template <class Compare>
- void merge(list&& x, Compare comp);
- void sort();
- template <class Compare>
- void sort(Compare comp);
- void reverse() noexcept;
-};
-
-
-template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
- list(InputIterator, InputIterator, Allocator = Allocator())
- -> list<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17
-
-template <class T, class Alloc>
- bool operator==(const list<T,Alloc>& x, const list<T,Alloc>& y);
-template <class T, class Alloc>
- bool operator< (const list<T,Alloc>& x, const list<T,Alloc>& y);
-template <class T, class Alloc>
- bool operator!=(const list<T,Alloc>& x, const list<T,Alloc>& y);
-template <class T, class Alloc>
- bool operator> (const list<T,Alloc>& x, const list<T,Alloc>& y);
-template <class T, class Alloc>
- bool operator>=(const list<T,Alloc>& x, const list<T,Alloc>& y);
-template <class T, class Alloc>
- bool operator<=(const list<T,Alloc>& x, const list<T,Alloc>& y);
-
-template <class T, class Alloc>
- void swap(list<T,Alloc>& x, list<T,Alloc>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class T, class Allocator, class U>
- typename list<T, Allocator>::size_type
- erase(list<T, Allocator>& c, const U& value); // C++20
-template <class T, class Allocator, class Predicate>
- typename list<T, Allocator>::size_type
- erase_if(list<T, Allocator>& c, Predicate pred); // C++20
-
-} // std
-
-*/
-
-#include <__algorithm/comp.h>
-#include <__algorithm/equal.h>
-#include <__algorithm/lexicographical_compare.h>
-#include <__algorithm/min.h>
-#include <__assert>
-#include <__config>
-#include <__debug>
-#include <__utility/forward.h>
-#include <initializer_list>
-#include <iterator>
-#include <limits>
-#include <memory>
-#include <type_traits>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp, class _VoidPtr> struct __list_node;
-template <class _Tp, class _VoidPtr> struct __list_node_base;
-
-template <class _Tp, class _VoidPtr>
-struct __list_node_pointer_traits {
- typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
- __node_pointer;
- typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type
- __base_pointer;
-
-#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB)
- typedef __base_pointer __link_pointer;
-#else
- typedef typename conditional<
- is_pointer<_VoidPtr>::value,
- __base_pointer,
- __node_pointer
- >::type __link_pointer;
-#endif
-
- typedef typename conditional<
- is_same<__link_pointer, __node_pointer>::value,
- __base_pointer,
- __node_pointer
- >::type __non_link_pointer;
-
- static _LIBCPP_INLINE_VISIBILITY
- __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) {
- return __p;
- }
-
- static _LIBCPP_INLINE_VISIBILITY
- __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) {
- return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p));
- }
-
-};
-
-template <class _Tp, class _VoidPtr>
-struct __list_node_base
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__node_pointer __node_pointer;
- typedef typename _NodeTraits::__base_pointer __base_pointer;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
-
- __link_pointer __prev_;
- __link_pointer __next_;
-
- _LIBCPP_INLINE_VISIBILITY
- __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())),
- __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {}
-
- _LIBCPP_INLINE_VISIBILITY
- __base_pointer __self() {
- return pointer_traits<__base_pointer>::pointer_to(*this);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __node_pointer __as_node() {
- return static_cast<__node_pointer>(__self());
- }
-};
-
-template <class _Tp, class _VoidPtr>
-struct _LIBCPP_STANDALONE_DEBUG __list_node
- : public __list_node_base<_Tp, _VoidPtr>
-{
- _Tp __value_;
-
- typedef __list_node_base<_Tp, _VoidPtr> __base;
- typedef typename __base::__link_pointer __link_pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- __link_pointer __as_link() {
- return static_cast<__link_pointer>(__base::__self());
- }
-};
-
-template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS list;
-template <class _Tp, class _Alloc> class __list_imp;
-template <class _Tp, class _VoidPtr> class _LIBCPP_TEMPLATE_VIS __list_const_iterator;
-
-template <class _Tp, class _VoidPtr>
-class _LIBCPP_TEMPLATE_VIS __list_iterator
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
-
- __link_pointer __ptr_;
-
-#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_INLINE_VISIBILITY
- explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
- : __ptr_(__p)
- {
- __get_db()->__insert_ic(this, __c);
- }
-#else
- _LIBCPP_INLINE_VISIBILITY
- explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
-#endif
-
-
-
- template<class, class> friend class list;
- template<class, class> friend class __list_imp;
- template<class, class> friend class __list_const_iterator;
-public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef value_type& reference;
- typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer;
- typedef typename pointer_traits<pointer>::difference_type difference_type;
-
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator() _NOEXCEPT : __ptr_(nullptr)
- {
- _VSTD::__debug_db_insert_i(this);
- }
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator(const __list_iterator& __p)
- : __ptr_(__p.__ptr_)
- {
- __get_db()->__iterator_copy(this, _VSTD::addressof(__p));
- }
-
- _LIBCPP_INLINE_VISIBILITY
- ~__list_iterator()
- {
- __get_db()->__erase_i(this);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator& operator=(const __list_iterator& __p)
- {
- if (this != _VSTD::addressof(__p))
- {
- __get_db()->__iterator_copy(this, _VSTD::addressof(__p));
- __ptr_ = __p.__ptr_;
- }
- return *this;
- }
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
- _LIBCPP_INLINE_VISIBILITY
- reference operator*() const
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
- "Attempted to dereference a non-dereferenceable list::iterator");
- return __ptr_->__as_node()->__value_;
- }
- _LIBCPP_INLINE_VISIBILITY
- pointer operator->() const
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
- "Attempted to dereference a non-dereferenceable list::iterator");
- return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator& operator++()
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
- "Attempted to increment a non-incrementable list::iterator");
- __ptr_ = __ptr_->__next_;
- return *this;
- }
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator& operator--()
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this),
- "Attempted to decrement a non-decrementable list::iterator");
- __ptr_ = __ptr_->__prev_;
- return *this;
- }
- _LIBCPP_INLINE_VISIBILITY
- __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(const __list_iterator& __x, const __list_iterator& __y)
- {
- return __x.__ptr_ == __y.__ptr_;
- }
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
- {return !(__x == __y);}
-};
-
-template <class _Tp, class _VoidPtr>
-class _LIBCPP_TEMPLATE_VIS __list_const_iterator
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
-
- __link_pointer __ptr_;
-
-#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_INLINE_VISIBILITY
- explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
- : __ptr_(__p)
- {
- __get_db()->__insert_ic(this, __c);
- }
-#else
- _LIBCPP_INLINE_VISIBILITY
- explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
-#endif
-
- template<class, class> friend class list;
- template<class, class> friend class __list_imp;
-public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef const value_type& reference;
- typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer;
- typedef typename pointer_traits<pointer>::difference_type difference_type;
-
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
- {
- _VSTD::__debug_db_insert_i(this);
- }
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
- : __ptr_(__p.__ptr_)
- {
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__iterator_copy(this, _VSTD::addressof(__p));
-#endif
- }
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator(const __list_const_iterator& __p)
- : __ptr_(__p.__ptr_)
- {
- __get_db()->__iterator_copy(this, _VSTD::addressof(__p));
- }
-
- _LIBCPP_INLINE_VISIBILITY
- ~__list_const_iterator()
- {
- __get_db()->__erase_i(this);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator& operator=(const __list_const_iterator& __p)
- {
- if (this != _VSTD::addressof(__p))
- {
- __get_db()->__iterator_copy(this, _VSTD::addressof(__p));
- __ptr_ = __p.__ptr_;
- }
- return *this;
- }
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_INLINE_VISIBILITY
- reference operator*() const
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
- "Attempted to dereference a non-dereferenceable list::const_iterator");
- return __ptr_->__as_node()->__value_;
- }
- _LIBCPP_INLINE_VISIBILITY
- pointer operator->() const
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
- "Attempted to dereference a non-dereferenceable list::const_iterator");
- return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator& operator++()
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
- "Attempted to increment a non-incrementable list::const_iterator");
- __ptr_ = __ptr_->__next_;
- return *this;
- }
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator& operator--()
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this),
- "Attempted to decrement a non-decrementable list::const_iterator");
- __ptr_ = __ptr_->__prev_;
- return *this;
- }
- _LIBCPP_INLINE_VISIBILITY
- __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
- {
- return __x.__ptr_ == __y.__ptr_;
- }
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
- {return !(__x == __y);}
-};
-
-template <class _Tp, class _Alloc>
-class __list_imp
-{
- __list_imp(const __list_imp&);
- __list_imp& operator=(const __list_imp&);
-public:
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
-protected:
- typedef _Tp value_type;
- typedef typename __alloc_traits::void_pointer __void_pointer;
- typedef __list_iterator<value_type, __void_pointer> iterator;
- typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
- typedef __list_node_base<value_type, __void_pointer> __node_base;
- typedef __list_node<value_type, __void_pointer> __node;
- typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
- typedef allocator_traits<__node_allocator> __node_alloc_traits;
- typedef typename __node_alloc_traits::pointer __node_pointer;
- typedef typename __node_alloc_traits::pointer __node_const_pointer;
- typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits;
- typedef typename __node_pointer_traits::__link_pointer __link_pointer;
- typedef __link_pointer __link_const_pointer;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator;
- typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
-
- __node_base __end_;
- __compressed_pair<size_type, __node_allocator> __size_alloc_;
-
- _LIBCPP_INLINE_VISIBILITY
- __link_pointer __end_as_link() const _NOEXCEPT {
- return __node_pointer_traits::__unsafe_link_pointer_cast(
- const_cast<__node_base&>(__end_).__self());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- size_type& __sz() _NOEXCEPT {return __size_alloc_.first();}
- _LIBCPP_INLINE_VISIBILITY
- const size_type& __sz() const _NOEXCEPT
- {return __size_alloc_.first();}
- _LIBCPP_INLINE_VISIBILITY
- __node_allocator& __node_alloc() _NOEXCEPT
- {return __size_alloc_.second();}
- _LIBCPP_INLINE_VISIBILITY
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __size_alloc_.second();}
-
- _LIBCPP_INLINE_VISIBILITY
- size_type __node_alloc_max_size() const _NOEXCEPT {
- return __node_alloc_traits::max_size(__node_alloc());
- }
- _LIBCPP_INLINE_VISIBILITY
- static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT;
-
- _LIBCPP_INLINE_VISIBILITY
- __list_imp()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
- _LIBCPP_INLINE_VISIBILITY
- __list_imp(const allocator_type& __a);
- _LIBCPP_INLINE_VISIBILITY
- __list_imp(const __node_allocator& __a);
-#ifndef _LIBCPP_CXX03_LANG
- __list_imp(__node_allocator&& __a) _NOEXCEPT;
-#endif
- ~__list_imp();
- void clear() _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __sz() == 0;}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT
- {
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__end_.__next_, this);
-#else
- return iterator(__end_.__next_);
-#endif
- }
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT
- {
-#if _LIBCPP_DEBUG_LEVEL == 2
- return const_iterator(__end_.__next_, this);
-#else
- return const_iterator(__end_.__next_);
-#endif
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT
- {
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__end_as_link(), this);
-#else
- return iterator(__end_as_link());
-#endif
- }
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT
- {
-#if _LIBCPP_DEBUG_LEVEL == 2
- return const_iterator(__end_as_link(), this);
-#else
- return const_iterator(__end_as_link());
-#endif
- }
-
- void swap(__list_imp& __c)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
-#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __list_imp& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__list_imp& __c)
- _NOEXCEPT_(
- !__node_alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_move_assignment::value>());}
-
-private:
- _LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __list_imp& __c, true_type)
- {
- if (__node_alloc() != __c.__node_alloc())
- clear();
- __node_alloc() = __c.__node_alloc();
- }
-
- _LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __list_imp&, false_type)
- {}
-
- _LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__list_imp& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {
- __node_alloc() = _VSTD::move(__c.__node_alloc());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__list_imp&, false_type)
- _NOEXCEPT
- {}
-
- _LIBCPP_INLINE_VISIBILITY
- void __invalidate_all_iterators() {
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
- }
-};
-
-// Unlink nodes [__f, __l]
-template <class _Tp, class _Alloc>
-inline
-void
-__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l)
- _NOEXCEPT
-{
- __f->__prev_->__next_ = __l->__next_;
- __l->__next_->__prev_ = __f->__prev_;
-}
-
-template <class _Tp, class _Alloc>
-inline
-__list_imp<_Tp, _Alloc>::__list_imp()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- : __size_alloc_(0, __default_init_tag())
-{
-}
-
-template <class _Tp, class _Alloc>
-inline
-__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
- : __size_alloc_(0, __node_allocator(__a))
-{
-}
-
-template <class _Tp, class _Alloc>
-inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a)
- : __size_alloc_(0, __a) {}
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class _Tp, class _Alloc>
-inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
- : __size_alloc_(0, _VSTD::move(__a)) {}
-#endif
-
-template <class _Tp, class _Alloc>
-__list_imp<_Tp, _Alloc>::~__list_imp() {
- clear();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__erase_c(this);
-#endif
-}
-
-template <class _Tp, class _Alloc>
-void
-__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
-{
- if (!empty())
- {
- __node_allocator& __na = __node_alloc();
- __link_pointer __f = __end_.__next_;
- __link_pointer __l = __end_as_link();
- __unlink_nodes(__f, __l->__prev_);
- __sz() = 0;
- while (__f != __l)
- {
- __node_pointer __np = __f->__as_node();
- __f = __f->__next_;
- __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
- __node_alloc_traits::deallocate(__na, __np, 1);
- }
- __invalidate_all_iterators();
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
-#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
-#endif
-{
- _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value ||
- this->__node_alloc() == __c.__node_alloc(),
- "list::swap: Either propagate_on_container_swap must be true"
- " or the allocators must compare equal");
- using _VSTD::swap;
- _VSTD::__swap_allocator(__node_alloc(), __c.__node_alloc());
- swap(__sz(), __c.__sz());
- swap(__end_, __c.__end_);
- if (__sz() == 0)
- __end_.__next_ = __end_.__prev_ = __end_as_link();
- else
- __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link();
- if (__c.__sz() == 0)
- __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
- else
- __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
-
-#if _LIBCPP_DEBUG_LEVEL == 2
- __libcpp_db* __db = __get_db();
- __c_node* __cn1 = __db->__find_c_and_lock(this);
- __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
- _VSTD::swap(__cn1->beg_, __cn2->beg_);
- _VSTD::swap(__cn1->end_, __cn2->end_);
- _VSTD::swap(__cn1->cap_, __cn2->cap_);
- for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;)
- {
- --__p;
- const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
- if (__i->__ptr_ == __c.__end_as_link())
- {
- __cn2->__add(*__p);
- if (--__cn1->end_ != __p)
- _VSTD::memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*));
- }
- else
- (*__p)->__c_ = __cn1;
- }
- for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
- {
- --__p;
- const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
- if (__i->__ptr_ == __end_as_link())
- {
- __cn1->__add(*__p);
- if (--__cn2->end_ != __p)
- _VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
- }
- else
- (*__p)->__c_ = __cn2;
- }
- __db->unlock();
-#endif
-}
-
-template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS list
- : private __list_imp<_Tp, _Alloc>
-{
- typedef __list_imp<_Tp, _Alloc> base;
- typedef typename base::__node __node;
- typedef typename base::__node_allocator __node_allocator;
- typedef typename base::__node_pointer __node_pointer;
- typedef typename base::__node_alloc_traits __node_alloc_traits;
- typedef typename base::__node_base __node_base;
- typedef typename base::__node_base_pointer __node_base_pointer;
- typedef typename base::__link_pointer __link_pointer;
-
-public:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Invalid allocator::value_type");
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename base::pointer pointer;
- typedef typename base::const_pointer const_pointer;
- typedef typename base::size_type size_type;
- typedef typename base::difference_type difference_type;
- typedef typename base::iterator iterator;
- typedef typename base::const_iterator const_iterator;
- typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
- typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
-#if _LIBCPP_STD_VER > 17
- typedef size_type __remove_return_type;
-#else
- typedef void __remove_return_type;
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- list()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- {
- _VSTD::__debug_db_insert_c(this);
- }
- _LIBCPP_INLINE_VISIBILITY
- explicit list(const allocator_type& __a) : base(__a)
- {
- _VSTD::__debug_db_insert_c(this);
- }
- explicit list(size_type __n);
-#if _LIBCPP_STD_VER > 11
- explicit list(size_type __n, const allocator_type& __a);
-#endif
- list(size_type __n, const value_type& __x);
- template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
- list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a)
- {
- _VSTD::__debug_db_insert_c(this);
- for (; __n > 0; --__n)
- push_back(__x);
- }
-
- template <class _InpIter>
- list(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
- template <class _InpIter>
- list(_InpIter __f, _InpIter __l, const allocator_type& __a,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
-
- list(const list& __c);
- list(const list& __c, const __identity_t<allocator_type>& __a);
- _LIBCPP_INLINE_VISIBILITY
- list& operator=(const list& __c);
-#ifndef _LIBCPP_CXX03_LANG
- list(initializer_list<value_type> __il);
- list(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_INLINE_VISIBILITY
- list(list&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
- _LIBCPP_INLINE_VISIBILITY
- list(list&& __c, const __identity_t<allocator_type>& __a);
- _LIBCPP_INLINE_VISIBILITY
- list& operator=(list&& __c)
- _NOEXCEPT_(
- __node_alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
-
- _LIBCPP_INLINE_VISIBILITY
- list& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
-
- _LIBCPP_INLINE_VISIBILITY
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
-
- template <class _InpIter>
- void assign(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
- void assign(size_type __n, const value_type& __x);
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT;
-
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return base::__sz();}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return base::empty();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT
- {
- return _VSTD::min<size_type>(
- base::__node_alloc_max_size(),
- numeric_limits<difference_type >::max());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return base::begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return base::begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return base::end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return base::end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return base::begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return base::end();}
-
- _LIBCPP_INLINE_VISIBILITY
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator crend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_INLINE_VISIBILITY
- reference front()
- {
- _LIBCPP_ASSERT(!empty(), "list::front called on empty list");
- return base::__end_.__next_->__as_node()->__value_;
- }
- _LIBCPP_INLINE_VISIBILITY
- const_reference front() const
- {
- _LIBCPP_ASSERT(!empty(), "list::front called on empty list");
- return base::__end_.__next_->__as_node()->__value_;
- }
- _LIBCPP_INLINE_VISIBILITY
- reference back()
- {
- _LIBCPP_ASSERT(!empty(), "list::back called on empty list");
- return base::__end_.__prev_->__as_node()->__value_;
- }
- _LIBCPP_INLINE_VISIBILITY
- const_reference back() const
- {
- _LIBCPP_ASSERT(!empty(), "list::back called on empty list");
- return base::__end_.__prev_->__as_node()->__value_;
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- void push_front(value_type&& __x);
- void push_back(value_type&& __x);
-
- template <class... _Args>
-#if _LIBCPP_STD_VER > 14
- reference emplace_front(_Args&&... __args);
-#else
- void emplace_front(_Args&&... __args);
-#endif
- template <class... _Args>
-#if _LIBCPP_STD_VER > 14
- reference emplace_back(_Args&&... __args);
-#else
- void emplace_back(_Args&&... __args);
-#endif
- template <class... _Args>
- iterator emplace(const_iterator __p, _Args&&... __args);
-
- iterator insert(const_iterator __p, value_type&& __x);
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
-
- void push_front(const value_type& __x);
- void push_back(const value_type& __x);
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class _Arg>
- _LIBCPP_INLINE_VISIBILITY
- void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); }
-#else
- _LIBCPP_INLINE_VISIBILITY
- void __emplace_back(value_type const& __arg) { push_back(__arg); }
-#endif
-
- iterator insert(const_iterator __p, const value_type& __x);
- iterator insert(const_iterator __p, size_type __n, const value_type& __x);
- template <class _InpIter>
- iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(list& __c)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
-#else
- _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
-#endif
- {base::swap(__c);}
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {base::clear();}
-
- void pop_front();
- void pop_back();
-
- iterator erase(const_iterator __p);
- iterator erase(const_iterator __f, const_iterator __l);
-
- void resize(size_type __n);
- void resize(size_type __n, const value_type& __x);
-
- void splice(const_iterator __p, list& __c);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
- _LIBCPP_INLINE_VISIBILITY
- void splice(const_iterator __p, list&& __c, const_iterator __i)
- {splice(__p, __c, __i);}
- _LIBCPP_INLINE_VISIBILITY
- void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
- {splice(__p, __c, __f, __l);}
-#endif
- void splice(const_iterator __p, list& __c, const_iterator __i);
- void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
-
- __remove_return_type remove(const value_type& __x);
- template <class _Pred> __remove_return_type remove_if(_Pred __pred);
- _LIBCPP_INLINE_VISIBILITY
- __remove_return_type unique() { return unique(__equal_to<value_type>()); }
- template <class _BinaryPred>
- __remove_return_type unique(_BinaryPred __binary_pred);
- _LIBCPP_INLINE_VISIBILITY
- void merge(list& __c);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void merge(list&& __c) {merge(__c);}
-
- template <class _Comp>
- _LIBCPP_INLINE_VISIBILITY
- void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
-#endif
- template <class _Comp>
- void merge(list& __c, _Comp __comp);
-
- _LIBCPP_INLINE_VISIBILITY
- void sort();
- template <class _Comp>
- _LIBCPP_INLINE_VISIBILITY
- void sort(_Comp __comp);
-
- void reverse() _NOEXCEPT;
-
- bool __invariants() const;
-
- typedef __allocator_destructor<__node_allocator> __node_destructor;
- typedef unique_ptr<__node, __node_destructor> __hold_pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- __hold_pointer __allocate_node(__node_allocator& __na) {
- __node_pointer __p = __node_alloc_traits::allocate(__na, 1);
- __p->__prev_ = nullptr;
- return __hold_pointer(__p, __node_destructor(__na, 1));
- }
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- bool __dereferenceable(const const_iterator* __i) const;
- bool __decrementable(const const_iterator* __i) const;
- bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
- bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
-private:
- _LIBCPP_INLINE_VISIBILITY
- static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l);
- _LIBCPP_INLINE_VISIBILITY
- void __link_nodes_at_front(__link_pointer __f, __link_pointer __l);
- _LIBCPP_INLINE_VISIBILITY
- void __link_nodes_at_back (__link_pointer __f, __link_pointer __l);
- iterator __iterator(size_type __n);
- template <class _Comp>
- static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
-
- void __move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
- void __move_assign(list& __c, false_type);
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(_InputIterator, _InputIterator)
- -> list<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(_InputIterator, _InputIterator, _Alloc)
- -> list<__iter_value_type<_InputIterator>, _Alloc>;
-#endif
-
-// Link in nodes [__f, __l] just prior to __p
-template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l)
-{
- __p->__prev_->__next_ = __f;
- __f->__prev_ = __p->__prev_;
- __p->__prev_ = __l;
- __l->__next_ = __p;
-}
-
-// Link in nodes [__f, __l] at the front of the list
-template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l)
-{
- __f->__prev_ = base::__end_as_link();
- __l->__next_ = base::__end_.__next_;
- __l->__next_->__prev_ = __l;
- base::__end_.__next_ = __f;
-}
-
-// Link in nodes [__f, __l] at the back of the list
-template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l)
-{
- __l->__next_ = base::__end_as_link();
- __f->__prev_ = base::__end_.__prev_;
- __f->__prev_->__next_ = __f;
- base::__end_.__prev_ = __l;
-}
-
-
-template <class _Tp, class _Alloc>
-inline
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::__iterator(size_type __n)
-{
- return __n <= base::__sz() / 2 ? _VSTD::next(begin(), __n)
- : _VSTD::prev(end(), base::__sz() - __n);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n)
-{
- _VSTD::__debug_db_insert_c(this);
- for (; __n > 0; --__n)
-#ifndef _LIBCPP_CXX03_LANG
- emplace_back();
-#else
- push_back(value_type());
-#endif
-}
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
-{
- _VSTD::__debug_db_insert_c(this);
- for (; __n > 0; --__n)
- emplace_back();
-}
-#endif
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
-{
- _VSTD::__debug_db_insert_c(this);
- for (; __n > 0; --__n)
- push_back(__x);
-}
-
-template <class _Tp, class _Alloc>
-template <class _InpIter>
-list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
-{
- _VSTD::__debug_db_insert_c(this);
- for (; __f != __l; ++__f)
- __emplace_back(*__f);
-}
-
-template <class _Tp, class _Alloc>
-template <class _InpIter>
-list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
- : base(__a)
-{
- _VSTD::__debug_db_insert_c(this);
- for (; __f != __l; ++__f)
- __emplace_back(*__f);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(const list& __c)
- : base(__node_alloc_traits::select_on_container_copy_construction(
- __c.__node_alloc())) {
- _VSTD::__debug_db_insert_c(this);
- for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
- push_back(*__i);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(const list& __c, const __identity_t<allocator_type>& __a)
- : base(__a)
-{
- _VSTD::__debug_db_insert_c(this);
- for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
- push_back(*__i);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
- : base(__a)
-{
- _VSTD::__debug_db_insert_c(this);
- for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
- __e = __il.end(); __i != __e; ++__i)
- push_back(*__i);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
-{
- _VSTD::__debug_db_insert_c(this);
- for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
- __e = __il.end(); __i != __e; ++__i)
- push_back(*__i);
-}
-
-template <class _Tp, class _Alloc>
-inline list<_Tp, _Alloc>::list(list&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
- : base(_VSTD::move(__c.__node_alloc())) {
- _VSTD::__debug_db_insert_c(this);
- splice(end(), __c);
-}
-
-template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>::list(list&& __c, const __identity_t<allocator_type>& __a)
- : base(__a)
-{
- _VSTD::__debug_db_insert_c(this);
- if (__a == __c.get_allocator())
- splice(end(), __c);
- else
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
-}
-
-template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(list&& __c)
- _NOEXCEPT_(
- __node_alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
-{
- __move_assign(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
-{
- if (base::__node_alloc() != __c.__node_alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
-{
- clear();
- base::__move_assign_alloc(__c);
- splice(end(), __c);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(const list& __c)
-{
- if (this != _VSTD::addressof(__c))
- {
- base::__copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-template <class _InpIter>
-void
-list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
-{
- iterator __i = begin();
- iterator __e = end();
- for (; __f != __l && __i != __e; ++__f, (void) ++__i)
- *__i = *__f;
- if (__i == __e)
- insert(__e, __f, __l);
- else
- erase(__i, __e);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
-{
- iterator __i = begin();
- iterator __e = end();
- for (; __n > 0 && __i != __e; --__n, (void) ++__i)
- *__i = __x;
- if (__i == __e)
- insert(__e, __n, __x);
- else
- erase(__i, __e);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
-}
-
-template <class _Tp, class _Alloc>
-inline
-_Alloc
-list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT
-{
- return allocator_type(base::__node_alloc());
-}
-
-template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::insert(iterator, x) called with an iterator not referring to this list");
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link());
- ++base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__hold.release()->__as_link(), this);
-#else
- return iterator(__hold.release()->__as_link());
-#endif
-}
-
-template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::insert(iterator, n, x) called with an iterator not referring to this list");
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator __r(__p.__ptr_, this);
-#else
- iterator __r(__p.__ptr_);
-#endif
- if (__n > 0)
- {
- size_type __ds = 0;
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- ++__ds;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __r = iterator(__hold->__as_link(), this);
-#else
- __r = iterator(__hold->__as_link());
-#endif
- __hold.release();
- iterator __e = __r;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __hold.reset(__node_alloc_traits::allocate(__na, 1));
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- __e.__ptr_->__next_ = __hold->__as_link();
- __hold->__prev_ = __e.__ptr_;
- __hold.release();
- }
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
- if (__prev == 0)
- break;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __e = iterator(__prev, this);
-#else
- __e = iterator(__prev);
-#endif
- }
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
- }
- return __r;
-}
-
-template <class _Tp, class _Alloc>
-template <class _InpIter>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
- typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::insert(iterator, range) called with an iterator not referring to this list");
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator __r(__p.__ptr_, this);
-#else
- iterator __r(__p.__ptr_);
-#endif
- if (__f != __l)
- {
- size_type __ds = 0;
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
- ++__ds;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __r = iterator(__hold.get()->__as_link(), this);
-#else
- __r = iterator(__hold.get()->__as_link());
-#endif
- __hold.release();
- iterator __e = __r;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (++__f; __f != __l; ++__f, (void) ++__e, ++__ds)
- {
- __hold.reset(__node_alloc_traits::allocate(__na, 1));
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
- __e.__ptr_->__next_ = __hold.get()->__as_link();
- __hold->__prev_ = __e.__ptr_;
- __hold.release();
- }
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
- if (__prev == 0)
- break;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __e = iterator(__prev, this);
-#else
- __e = iterator(__prev);
-#endif
- }
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
- }
- return __r;
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_front(const value_type& __x)
-{
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- __link_pointer __nl = __hold->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
- __hold.release();
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_back(const value_type& __x)
-{
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link());
- ++base::__sz();
- __hold.release();
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_front(value_type&& __x)
-{
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
- __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link());
- ++base::__sz();
- __hold.release();
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_back(value_type&& __x)
-{
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
- __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link());
- ++base::__sz();
- __hold.release();
-}
-
-template <class _Tp, class _Alloc>
-template <class... _Args>
-#if _LIBCPP_STD_VER > 14
-typename list<_Tp, _Alloc>::reference
-#else
-void
-#endif
-list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
-{
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
- __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link());
- ++base::__sz();
-#if _LIBCPP_STD_VER > 14
- return __hold.release()->__value_;
-#else
- __hold.release();
-#endif
-}
-
-template <class _Tp, class _Alloc>
-template <class... _Args>
-#if _LIBCPP_STD_VER > 14
-typename list<_Tp, _Alloc>::reference
-#else
-void
-#endif
-list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
-{
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
- __link_pointer __nl = __hold->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
-#if _LIBCPP_STD_VER > 14
- return __hold.release()->__value_;
-#else
- __hold.release();
-#endif
-}
-
-template <class _Tp, class _Alloc>
-template <class... _Args>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::emplace(iterator, args...) called with an iterator not referring to this list");
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
- __link_pointer __nl = __hold.get()->__as_link();
- __link_nodes(__p.__ptr_, __nl, __nl);
- ++base::__sz();
- __hold.release();
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__nl, this);
-#else
- return iterator(__nl);
-#endif
-}
-
-template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::insert(iterator, x) called with an iterator not referring to this list");
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
- __link_pointer __nl = __hold->__as_link();
- __link_nodes(__p.__ptr_, __nl, __nl);
- ++base::__sz();
- __hold.release();
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__nl, this);
-#else
- return iterator(__nl);
-#endif
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::pop_front()
-{
- _LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
- __node_allocator& __na = base::__node_alloc();
- __link_pointer __n = base::__end_.__next_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __c_node* __c = __get_db()->__find_c_and_lock(this);
- for (__i_node** __p = __c->end_; __p != __c->beg_; )
- {
- --__p;
- iterator* __i = static_cast<iterator*>((*__p)->__i_);
- if (__i->__ptr_ == __n)
- {
- (*__p)->__c_ = nullptr;
- if (--__c->end_ != __p)
- _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
- }
- }
- __get_db()->unlock();
-#endif
- __node_pointer __np = __n->__as_node();
- __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
- __node_alloc_traits::deallocate(__na, __np, 1);
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::pop_back()
-{
- _LIBCPP_ASSERT(!empty(), "list::pop_back() called on an empty list");
- __node_allocator& __na = base::__node_alloc();
- __link_pointer __n = base::__end_.__prev_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __c_node* __c = __get_db()->__find_c_and_lock(this);
- for (__i_node** __p = __c->end_; __p != __c->beg_; )
- {
- --__p;
- iterator* __i = static_cast<iterator*>((*__p)->__i_);
- if (__i->__ptr_ == __n)
- {
- (*__p)->__c_ = nullptr;
- if (--__c->end_ != __p)
- _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
- }
- }
- __get_db()->unlock();
-#endif
- __node_pointer __np = __n->__as_node();
- __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
- __node_alloc_traits::deallocate(__na, __np, 1);
-}
-
-template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::erase(const_iterator __p)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::erase(iterator) called with an iterator not referring to this list");
- _LIBCPP_ASSERT(__p != end(),
- "list::erase(iterator) called with a non-dereferenceable iterator");
- __node_allocator& __na = base::__node_alloc();
- __link_pointer __n = __p.__ptr_;
- __link_pointer __r = __n->__next_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __c_node* __c = __get_db()->__find_c_and_lock(this);
- for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
- {
- --__ip;
- iterator* __i = static_cast<iterator*>((*__ip)->__i_);
- if (__i->__ptr_ == __n)
- {
- (*__ip)->__c_ = nullptr;
- if (--__c->end_ != __ip)
- _VSTD::memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*));
- }
- }
- __get_db()->unlock();
-#endif
- __node_pointer __np = __n->__as_node();
- __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
- __node_alloc_traits::deallocate(__na, __np, 1);
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__r, this);
-#else
- return iterator(__r);
-#endif
-}
-
-template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__f)) == this,
- "list::erase(iterator, iterator) called with an iterator not referring to this list");
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == this,
- "list::erase(iterator, iterator) called with an iterator not referring to this list");
- if (__f != __l)
- {
- __node_allocator& __na = base::__node_alloc();
- base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
- while (__f != __l)
- {
- __link_pointer __n = __f.__ptr_;
- ++__f;
- --base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __c_node* __c = __get_db()->__find_c_and_lock(this);
- for (__i_node** __p = __c->end_; __p != __c->beg_; )
- {
- --__p;
- iterator* __i = static_cast<iterator*>((*__p)->__i_);
- if (__i->__ptr_ == __n)
- {
- (*__p)->__c_ = nullptr;
- if (--__c->end_ != __p)
- _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
- }
- }
- __get_db()->unlock();
-#endif
- __node_pointer __np = __n->__as_node();
- __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
- __node_alloc_traits::deallocate(__na, __np, 1);
- }
- }
-#if _LIBCPP_DEBUG_LEVEL == 2
- return iterator(__l.__ptr_, this);
-#else
- return iterator(__l.__ptr_);
-#endif
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::resize(size_type __n)
-{
- if (__n < base::__sz())
- erase(__iterator(__n), end());
- else if (__n > base::__sz())
- {
- __n -= base::__sz();
- size_type __ds = 0;
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
- ++__ds;
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator __r = iterator(__hold.release()->__as_link(), this);
-#else
- iterator __r = iterator(__hold.release()->__as_link());
-#endif
- iterator __e = __r;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __hold.reset(__node_alloc_traits::allocate(__na, 1));
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
- __e.__ptr_->__next_ = __hold.get()->__as_link();
- __hold->__prev_ = __e.__ptr_;
- __hold.release();
- }
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
- if (__prev == 0)
- break;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __e = iterator(__prev, this);
-#else
- __e = iterator(__prev);
-#endif
- }
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
-{
- if (__n < base::__sz())
- erase(__iterator(__n), end());
- else if (__n > base::__sz())
- {
- __n -= base::__sz();
- size_type __ds = 0;
- __node_allocator& __na = base::__node_alloc();
- __hold_pointer __hold = __allocate_node(__na);
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- ++__ds;
- __link_pointer __nl = __hold.release()->__as_link();
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator __r = iterator(__nl, this);
-#else
- iterator __r = iterator(__nl);
-#endif
- iterator __e = __r;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __hold.reset(__node_alloc_traits::allocate(__na, 1));
- __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
- __e.__ptr_->__next_ = __hold.get()->__as_link();
- __hold->__prev_ = __e.__ptr_;
- __hold.release();
- }
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
- if (__prev == 0)
- break;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __e = iterator(__prev, this);
-#else
- __e = iterator(__prev);
-#endif
- }
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
-{
- _LIBCPP_ASSERT(this != _VSTD::addressof(__c),
- "list::splice(iterator, list) called with this == &list");
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::splice(iterator, list) called with an iterator not referring to this list");
- if (!__c.empty())
- {
- __link_pointer __f = __c.__end_.__next_;
- __link_pointer __l = __c.__end_.__prev_;
- base::__unlink_nodes(__f, __l);
- __link_nodes(__p.__ptr_, __f, __l);
- base::__sz() += __c.__sz();
- __c.__sz() = 0;
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (_VSTD::addressof(__c) != this) {
- __libcpp_db* __db = __get_db();
- __c_node* __cn1 = __db->__find_c_and_lock(this);
- __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
- for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
- {
- --__ip;
- iterator* __i = static_cast<iterator*>((*__ip)->__i_);
- if (__i->__ptr_ != __c.__end_as_link())
- {
- __cn1->__add(*__ip);
- (*__ip)->__c_ = __cn1;
- if (--__cn2->end_ != __ip)
- memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
- }
- }
- __db->unlock();
- }
-#endif
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::splice(iterator, list, iterator) called with the first iterator not referring to this list");
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__i)) == _VSTD::addressof(__c),
- "list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument");
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(_VSTD::addressof(__i)),
- "list::splice(iterator, list, iterator) called with the second iterator not dereferenceable");
-
- if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
- {
- __link_pointer __f = __i.__ptr_;
- base::__unlink_nodes(__f, __f);
- __link_nodes(__p.__ptr_, __f, __f);
- --__c.__sz();
- ++base::__sz();
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (_VSTD::addressof(__c) != this) {
- __libcpp_db* __db = __get_db();
- __c_node* __cn1 = __db->__find_c_and_lock(this);
- __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
- for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
- {
- --__ip;
- iterator* __j = static_cast<iterator*>((*__ip)->__i_);
- if (__j->__ptr_ == __f)
- {
- __cn1->__add(*__ip);
- (*__ip)->__c_ = __cn1;
- if (--__cn2->end_ != __ip)
- _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
- }
- }
- __db->unlock();
- }
-#endif
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
-{
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "list::splice(iterator, list, iterator, iterator) called with first iterator not referring to this list");
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__f)) == _VSTD::addressof(__c),
- "list::splice(iterator, list, iterator, iterator) called with second iterator not referring to the list argument");
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == _VSTD::addressof(__c),
- "list::splice(iterator, list, iterator, iterator) called with third iterator not referring to the list argument");
-
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (this == _VSTD::addressof(__c))
- {
- for (const_iterator __i = __f; __i != __l; ++__i)
- _LIBCPP_DEBUG_ASSERT(__i != __p,
- "list::splice(iterator, list, iterator, iterator)"
- " called with the first iterator within the range of the second and third iterators");
- }
-#endif
- if (__f != __l)
- {
- __link_pointer __first = __f.__ptr_;
- --__l;
- __link_pointer __last = __l.__ptr_;
- if (this != _VSTD::addressof(__c))
- {
- size_type __s = _VSTD::distance(__f, __l) + 1;
- __c.__sz() -= __s;
- base::__sz() += __s;
- }
- base::__unlink_nodes(__first, __last);
- __link_nodes(__p.__ptr_, __first, __last);
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (_VSTD::addressof(__c) != this) {
- __libcpp_db* __db = __get_db();
- __c_node* __cn1 = __db->__find_c_and_lock(this);
- __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
- for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
- {
- --__ip;
- iterator* __j = static_cast<iterator*>((*__ip)->__i_);
- for (__link_pointer __k = __f.__ptr_;
- __k != __l.__ptr_; __k = __k->__next_)
- {
- if (__j->__ptr_ == __k)
- {
- __cn1->__add(*__ip);
- (*__ip)->__c_ = __cn1;
- if (--__cn2->end_ != __ip)
- _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
- }
- }
- }
- __db->unlock();
- }
-#endif
- }
-}
-
-template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::remove(const value_type& __x)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (const_iterator __i = begin(), __e = end(); __i != __e;)
- {
- if (*__i == __x)
- {
- const_iterator __j = _VSTD::next(__i);
- for (; __j != __e && *__j == __x; ++__j)
- ;
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- if (__i != __e)
- ++__i;
- }
- else
- ++__i;
- }
-
- return (__remove_return_type) __deleted_nodes.size();
-}
-
-template <class _Tp, class _Alloc>
-template <class _Pred>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::remove_if(_Pred __pred)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- if (__pred(*__i))
- {
- iterator __j = _VSTD::next(__i);
- for (; __j != __e && __pred(*__j); ++__j)
- ;
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- if (__i != __e)
- ++__i;
- }
- else
- ++__i;
- }
-
- return (__remove_return_type) __deleted_nodes.size();
-}
-
-template <class _Tp, class _Alloc>
-template <class _BinaryPred>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- iterator __j = _VSTD::next(__i);
- for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
- ;
- if (++__i != __j) {
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- }
- }
-
- return (__remove_return_type) __deleted_nodes.size();
-}
-
-template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::merge(list& __c)
-{
- merge(__c, __less<value_type>());
-}
-
-template <class _Tp, class _Alloc>
-template <class _Comp>
-void
-list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
-{
- if (this != _VSTD::addressof(__c))
- {
- iterator __f1 = begin();
- iterator __e1 = end();
- iterator __f2 = __c.begin();
- iterator __e2 = __c.end();
- while (__f1 != __e1 && __f2 != __e2)
- {
- if (__comp(*__f2, *__f1))
- {
- size_type __ds = 1;
- iterator __m2 = _VSTD::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void) ++__ds)
- ;
- base::__sz() += __ds;
- __c.__sz() -= __ds;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = _VSTD::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- }
- splice(__e1, __c);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __libcpp_db* __db = __get_db();
- __c_node* __cn1 = __db->__find_c_and_lock(this);
- __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
- for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
- {
- --__p;
- iterator* __i = static_cast<iterator*>((*__p)->__i_);
- if (__i->__ptr_ != __c.__end_as_link())
- {
- __cn1->__add(*__p);
- (*__p)->__c_ = __cn1;
- if (--__cn2->end_ != __p)
- _VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
- }
- }
- __db->unlock();
-#endif
- }
-}
-
-template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::sort()
-{
- sort(__less<value_type>());
-}
-
-template <class _Tp, class _Alloc>
-template <class _Comp>
-inline
-void
-list<_Tp, _Alloc>::sort(_Comp __comp)
-{
- __sort(begin(), end(), base::__sz(), __comp);
-}
-
-template <class _Tp, class _Alloc>
-template <class _Comp>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
-{
- switch (__n)
- {
- case 0:
- case 1:
- return __f1;
- case 2:
- if (__comp(*--__e2, *__f1))
- {
- __link_pointer __f = __e2.__ptr_;
- base::__unlink_nodes(__f, __f);
- __link_nodes(__f1.__ptr_, __f, __f);
- return __e2;
- }
- return __f1;
- }
- size_type __n2 = __n / 2;
- iterator __e1 = _VSTD::next(__f1, __n2);
- iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
- iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
- if (__comp(*__f2, *__f1))
- {
- iterator __m2 = _VSTD::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
- ;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- __r = __f2;
- __e1 = __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = _VSTD::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- while (__f1 != __e1 && __f2 != __e2)
- {
- if (__comp(*__f2, *__f1))
- {
- iterator __m2 = _VSTD::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
- ;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- if (__e1 == __f2)
- __e1 = __m2;
- __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = _VSTD::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- }
- return __r;
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::reverse() _NOEXCEPT
-{
- if (base::__sz() > 1)
- {
- iterator __e = end();
- for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;)
- {
- _VSTD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
- __i.__ptr_ = __i.__ptr_->__prev_;
- }
- _VSTD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
- }
-}
-
-template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__invariants() const
-{
- return size() == _VSTD::distance(begin(), end());
-}
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
-template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
-{
- return __i->__ptr_ != this->__end_as_link();
-}
-
-template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__decrementable(const const_iterator* __i) const
-{
- return !empty() && __i->__ptr_ != base::__end_.__next_;
-}
-
-template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const
-{
- return false;
-}
-
-template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
-{
- return false;
-}
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return __y < __x;
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__x < __y);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__y < __x);
-}
-
-template <class _Tp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Tp, class _Allocator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY typename list<_Tp, _Allocator>::size_type
-erase_if(list<_Tp, _Allocator>& __c, _Predicate __pred) {
- return __c.remove_if(__pred);
-}
-
-template <class _Tp, class _Allocator, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY typename list<_Tp, _Allocator>::size_type
-erase(list<_Tp, _Allocator>& __c, const _Up& __v) {
- return _VSTD::erase_if(__c, [&](auto& __elem) { return __elem == __v; });
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_LIST
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/numbers b/contrib/libs/cxxsupp/libcxxmsvc/include/numbers
deleted file mode 100644
index 9a52d142c4..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/numbers
+++ /dev/null
@@ -1,133 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_NUMBERS
-#define _LIBCPP_NUMBERS
-
-/*
- numbers synopsis
-
-namespace std::numbers {
- template<class T> inline constexpr T e_v = unspecified;
- template<class T> inline constexpr T log2e_v = unspecified;
- template<class T> inline constexpr T log10e_v = unspecified;
- template<class T> inline constexpr T pi_v = unspecified;
- template<class T> inline constexpr T inv_pi_v = unspecified;
- template<class T> inline constexpr T inv_sqrtpi_v = unspecified;
- template<class T> inline constexpr T ln2_v = unspecified;
- template<class T> inline constexpr T ln10_v = unspecified;
- template<class T> inline constexpr T sqrt2_v = unspecified;
- template<class T> inline constexpr T sqrt3_v = unspecified;
- template<class T> inline constexpr T inv_sqrt3_v = unspecified;
- template<class T> inline constexpr T egamma_v = unspecified;
- template<class T> inline constexpr T phi_v = unspecified;
-
- template<floating_point T> inline constexpr T e_v<T> = see below;
- template<floating_point T> inline constexpr T log2e_v<T> = see below;
- template<floating_point T> inline constexpr T log10e_v<T> = see below;
- template<floating_point T> inline constexpr T pi_v<T> = see below;
- template<floating_point T> inline constexpr T inv_pi_v<T> = see below;
- template<floating_point T> inline constexpr T inv_sqrtpi_v<T> = see below;
- template<floating_point T> inline constexpr T ln2_v<T> = see below;
- template<floating_point T> inline constexpr T ln10_v<T> = see below;
- template<floating_point T> inline constexpr T sqrt2_v<T> = see below;
- template<floating_point T> inline constexpr T sqrt3_v<T> = see below;
- template<floating_point T> inline constexpr T inv_sqrt3_v<T> = see below;
- template<floating_point T> inline constexpr T egamma_v<T> = see below;
- template<floating_point T> inline constexpr T phi_v<T> = see below;
-
- inline constexpr double e = e_v<double>;
- inline constexpr double log2e = log2e_v<double>;
- inline constexpr double log10e = log10e_v<double>;
- inline constexpr double pi = pi_v<double>;
- inline constexpr double inv_pi = inv_pi_v<double>;
- inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
- inline constexpr double ln2 = ln2_v<double>;
- inline constexpr double ln10 = ln10_v<double>;
- inline constexpr double sqrt2 = sqrt2_v<double>;
- inline constexpr double sqrt3 = sqrt3_v<double>;
- inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>;
- inline constexpr double egamma = egamma_v<double>;
- inline constexpr double phi = phi_v<double>;
-}
-*/
-
-#include <__config>
-#include <concepts>
-#include <type_traits>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace numbers {
-
-template <class _Tp>
-inline constexpr bool __false = false;
-
-template <class _Tp>
-struct __illformed
-{
- static_assert(__false<_Tp>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
-};
-
-template <class _Tp> inline constexpr _Tp e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp log2e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp log10e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp pi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_pi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp ln2_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp ln10_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp sqrt2_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp sqrt3_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp egamma_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp phi_v = __illformed<_Tp>{};
-
-template <floating_point _Tp> inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662L;
-template <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892L;
-template <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605L;
-template <floating_point _Tp> inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502L;
-template <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028L;
-template <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772L;
-template <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176L;
-template <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364L;
-template <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698L;
-template <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872L;
-template <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957L;
-template <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402L;
-template <floating_point _Tp> inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638L;
-
-inline constexpr double e = e_v<double>;
-inline constexpr double log2e = log2e_v<double>;
-inline constexpr double log10e = log10e_v<double>;
-inline constexpr double pi = pi_v<double>;
-inline constexpr double inv_pi = inv_pi_v<double>;
-inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
-inline constexpr double ln2 = ln2_v<double>;
-inline constexpr double ln10 = ln10_v<double>;
-inline constexpr double sqrt2 = sqrt2_v<double>;
-inline constexpr double sqrt3 = sqrt3_v<double>;
-inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>;
-inline constexpr double egamma = egamma_v<double>;
-inline constexpr double phi = phi_v<double>;
-
-} // namespace numbers
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif //!defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-#endif // _LIBCPP_NUMBERS
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/queue b/contrib/libs/cxxsupp/libcxxmsvc/include/queue
deleted file mode 100644
index b8b7ec46d9..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/queue
+++ /dev/null
@@ -1,955 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_QUEUE
-#define _LIBCPP_QUEUE
-
-/*
- queue synopsis
-
-namespace std
-{
-
-template <class T, class Container = deque<T>>
-class queue
-{
-public:
- typedef Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
-
-protected:
- container_type c;
-
-public:
- queue() = default;
- ~queue() = default;
-
- queue(const queue& q) = default;
- queue(queue&& q) = default;
-
- queue& operator=(const queue& q) = default;
- queue& operator=(queue&& q) = default;
-
- explicit queue(const container_type& c);
- explicit queue(container_type&& c)
- template<class InputIterator>
- queue(InputIterator first, InputIterator last); // since C++23
- template <class Alloc>
- explicit queue(const Alloc& a);
- template <class Alloc>
- queue(const container_type& c, const Alloc& a);
- template <class Alloc>
- queue(container_type&& c, const Alloc& a);
- template <class Alloc>
- queue(const queue& q, const Alloc& a);
- template <class Alloc>
- queue(queue&& q, const Alloc& a);
- template <class InputIterator, class Alloc>
- queue(InputIterator first, InputIterator last, const Alloc&); // since C++23
-
- bool empty() const;
- size_type size() const;
-
- reference front();
- const_reference front() const;
- reference back();
- const_reference back() const;
-
- void push(const value_type& v);
- void push(value_type&& v);
- template <class... Args> reference emplace(Args&&... args); // reference in C++17
- void pop();
-
- void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
-};
-
-template<class Container>
- queue(Container) -> queue<typename Container::value_type, Container>; // C++17
-
-template<class InputIterator>
- queue(InputIterator, InputIterator) -> queue<iter-value-type<InputIterator>>; // since C++23
-
-template<class Container, class Allocator>
- queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17
-
-template<class InputIterator, class Allocator>
- queue(InputIterator, InputIterator, Allocator)
- -> queue<iter-value-type<InputIterator>,
- deque<iter-value-type<InputIterator>, Allocator>>; // since C++23
-
-template <class T, class Container>
- bool operator==(const queue<T, Container>& x,const queue<T, Container>& y);
-
-template <class T, class Container>
- bool operator< (const queue<T, Container>& x,const queue<T, Container>& y);
-
-template <class T, class Container>
- bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y);
-
-template <class T, class Container>
- bool operator> (const queue<T, Container>& x,const queue<T, Container>& y);
-
-template <class T, class Container>
- bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y);
-
-template <class T, class Container>
- bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
-
-template <class T, class Container>
- void swap(queue<T, Container>& x, queue<T, Container>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class T, class Container = vector<T>,
- class Compare = less<typename Container::value_type>>
-class priority_queue
-{
-public:
- typedef Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
-
-protected:
- container_type c;
- Compare comp;
-
-public:
- priority_queue() : priority_queue(Compare()) {} // C++20
- explicit priority_queue(const Compare& x) : priority_queue(x, Container()) {}
- priority_queue(const Compare& x, const Container&);
- explicit priority_queue(const Compare& x = Compare(), Container&& = Container()); // before C++20
- priority_queue(const Compare& x, Container&&); // C++20
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Compare& comp = Compare());
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Compare& comp, const Container& c);
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Compare& comp, Container&& c);
- template <class Alloc>
- explicit priority_queue(const Alloc& a);
- template <class Alloc>
- priority_queue(const Compare& comp, const Alloc& a);
- template <class Alloc>
- priority_queue(const Compare& comp, const Container& c,
- const Alloc& a);
- template <class Alloc>
- priority_queue(const Compare& comp, Container&& c,
- const Alloc& a);
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Alloc& a);
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Compare& comp, const Alloc& a);
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Compare& comp, const Container& c, const Alloc& a);
- template <class InputIterator>
- priority_queue(InputIterator first, InputIterator last,
- const Compare& comp, Container&& c, const Alloc& a);
- template <class Alloc>
- priority_queue(const priority_queue& q, const Alloc& a);
- template <class Alloc>
- priority_queue(priority_queue&& q, const Alloc& a);
-
- bool empty() const;
- size_type size() const;
- const_reference top() const;
-
- void push(const value_type& v);
- void push(value_type&& v);
- template <class... Args> void emplace(Args&&... args);
- void pop();
-
- void swap(priority_queue& q)
- noexcept(is_nothrow_swappable_v<Container> &&
- is_nothrow_swappable_v<Comp>)
-};
-
-template <class Compare, class Container>
-priority_queue(Compare, Container)
- -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
-
-template<class InputIterator,
- class Compare = less<iter-value-type<InputIterator>>,
- class Container = vector<iter-value-type<InputIterator>>>
-priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
- -> priority_queue<iter-value-type<InputIterator>, Container, Compare>; // C++17
-
-template<class Compare, class Container, class Allocator>
-priority_queue(Compare, Container, Allocator)
- -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
-
-template<class InputIterator, class Allocator>
-priority_queue(InputIterator, InputIterator, Allocator)
- -> priority_queue<iter-value-type<InputIterator>,
- vector<iter-value-type<InputIterator>, Allocator>,
- less<iter-value-type<InputIterator>>>; // C++17
-
-template<class InputIterator, class Compare, class Allocator>
-priority_queue(InputIterator, InputIterator, Compare, Allocator)
- -> priority_queue<iter-value-type<InputIterator>,
- vector<iter-value-type<InputIterator>, Allocator>, Compare>; // C++17
-
-template<class InputIterator, class Compare, class Container, class Allocator>
-priority_queue(InputIterator, InputIterator, Compare, Container, Allocator)
- -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
-
-template <class T, class Container, class Compare>
- void swap(priority_queue<T, Container, Compare>& x,
- priority_queue<T, Container, Compare>& y)
- noexcept(noexcept(x.swap(y)));
-
-} // std
-
-*/
-
-#include <__algorithm/make_heap.h>
-#include <__algorithm/pop_heap.h>
-#include <__algorithm/push_heap.h>
-#include <__config>
-#include <__iterator/iterator_traits.h>
-#include <__memory/uses_allocator.h>
-#include <__utility/forward.h>
-#include <compare>
-#include <deque>
-#include <functional>
-#include <type_traits>
-#include <vector>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS queue;
-
-template <class _Tp, class _Container>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
-
-template <class _Tp, class _Container>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
-
-template <class _Tp, class _Container /*= deque<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS queue
-{
-public:
- typedef _Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
-
-protected:
- container_type c;
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- queue()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
- : c() {}
-
- _LIBCPP_INLINE_VISIBILITY
- queue(const queue& __q) : c(__q.c) {}
-
-#if _LIBCPP_STD_VER > 20
- template <class _InputIterator,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-
- template <class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc) : c(__first, __second, __alloc) {}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- queue& operator=(const queue& __q) {c = __q.c; return *this;}
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- queue(queue&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
- : c(_VSTD::move(__q.c)) {}
-
- _LIBCPP_INLINE_VISIBILITY
- queue& operator=(queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
- {c = _VSTD::move(__q.c); return *this;}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- explicit queue(const container_type& __c) : c(__c) {}
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
-#endif // _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- explicit queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__a) {}
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- queue(const queue& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__q.c, __a) {}
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- queue(const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__c, __a) {}
-#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- queue(container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(_VSTD::move(__c), __a) {}
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- queue(queue&& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(_VSTD::move(__q.c), __a) {}
-
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const {return c.empty();}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const {return c.size();}
-
- _LIBCPP_INLINE_VISIBILITY
- reference front() {return c.front();}
- _LIBCPP_INLINE_VISIBILITY
- const_reference front() const {return c.front();}
- _LIBCPP_INLINE_VISIBILITY
- reference back() {return c.back();}
- _LIBCPP_INLINE_VISIBILITY
- const_reference back() const {return c.back();}
-
- _LIBCPP_INLINE_VISIBILITY
- void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
-#if _LIBCPP_STD_VER > 14
- decltype(auto) emplace(_Args&&... __args)
- { return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
-#else
- void emplace(_Args&&... __args)
- { c.emplace_back(_VSTD::forward<_Args>(__args)...);}
-#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void pop() {c.pop_front();}
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
- {
- using _VSTD::swap;
- swap(c, __q.c);
- }
-
- template <class _T1, class _C1>
- friend
- _LIBCPP_INLINE_VISIBILITY
- bool
- operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
-
- template <class _T1, class _C1>
- friend
- _LIBCPP_INLINE_VISIBILITY
- bool
- operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
-};
-
-#if _LIBCPP_STD_VER > 14
-template<class _Container,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-queue(_Container)
- -> queue<typename _Container::value_type, _Container>;
-
-template<class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-queue(_Container, _Alloc)
- -> queue<typename _Container::value_type, _Container>;
-#endif
-
-#if _LIBCPP_STD_VER > 20
-template <class _InputIterator,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>>
-queue(_InputIterator, _InputIterator)
- -> queue<__iter_value_type<_InputIterator>>;
-
-template <class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
-queue(_InputIterator, _InputIterator, _Alloc)
- -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
-#endif
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __x.c == __y.c;
-}
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __x.c < __y.c;
-}
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __y < __x;
-}
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__x < __y);
-}
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__y < __x);
-}
-
-template <class _Tp, class _Container>
-inline _LIBCPP_INLINE_VISIBILITY
-__enable_if_t<__is_swappable<_Container>::value, void>
-swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-template <class _Tp, class _Container, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
-};
-
-template <class _Tp, class _Container = vector<_Tp>,
- class _Compare = less<typename _Container::value_type> >
-class _LIBCPP_TEMPLATE_VIS priority_queue
-{
-public:
- typedef _Container container_type;
- typedef _Compare value_compare;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
-
-protected:
- container_type c;
- value_compare comp;
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- priority_queue()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
- is_nothrow_default_constructible<value_compare>::value)
- : c(), comp() {}
-
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
-
- _LIBCPP_INLINE_VISIBILITY
- priority_queue& operator=(const priority_queue& __q)
- {c = __q.c; comp = __q.comp; return *this;}
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
- is_nothrow_move_constructible<value_compare>::value)
- : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
-
- _LIBCPP_INLINE_VISIBILITY
- priority_queue& operator=(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
- is_nothrow_move_assignable<value_compare>::value)
- {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- explicit priority_queue(const value_compare& __comp)
- : c(), comp(__comp) {}
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const value_compare& __comp, const container_type& __c);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const value_compare& __comp, container_type&& __c);
-#endif
- template <class _InputIter, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp = value_compare());
- template <class _InputIter, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c);
-#ifndef _LIBCPP_CXX03_LANG
- template <class _InputIter, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, container_type&& __c);
-#endif // _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- explicit priority_queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const value_compare& __comp, const container_type& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const priority_queue& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(const value_compare& __comp, container_type&& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(priority_queue&& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-#endif // _LIBCPP_CXX03_LANG
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> >
- _LIBCPP_INLINE_VISIBILITY
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const {return c.empty();}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const {return c.size();}
- _LIBCPP_INLINE_VISIBILITY
- const_reference top() const {return c.front();}
-
- _LIBCPP_INLINE_VISIBILITY
- void push(const value_type& __v);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void push(value_type&& __v);
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- void emplace(_Args&&... __args);
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void pop();
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
- __is_nothrow_swappable<value_compare>::value);
-};
-
-#if _LIBCPP_STD_VER >= 17
-template <class _Compare,
- class _Container,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-priority_queue(_Compare, _Container)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Container = vector<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
- -> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
-
-template<class _Compare,
- class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-priority_queue(_Compare, _Container, _Alloc)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
->
-priority_queue(_InputIterator, _InputIterator, _Allocator)
- -> priority_queue<__iter_value_type<_InputIterator>,
- vector<__iter_value_type<_InputIterator>, _Allocator>,
- less<__iter_value_type<_InputIterator>>>;
-
-template<class _InputIterator, class _Compare, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
->
-priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator)
- -> priority_queue<__iter_value_type<_InputIterator>,
- vector<__iter_value_type<_InputIterator>, _Allocator>, _Compare>;
-
-template<class _InputIterator, class _Compare, class _Container, class _Alloc,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-#endif
-
-template <class _Tp, class _Container, class _Compare>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
- const container_type& __c)
- : c(__c),
- comp(__comp)
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- container_type&& __c)
- : c(_VSTD::move(__c)),
- comp(__comp)
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp)
- : c(__f, __l),
- comp(__comp)
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp,
- const container_type& __c)
- : c(__c),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp,
- container_type&& __c)
- : c(_VSTD::move(__c)),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__a)
-{
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__a),
- comp(__comp)
-{
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- const container_type& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__c, __a),
- comp(__comp)
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__q.c, __a),
- comp(__q.comp)
-{
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- container_type&& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(_VSTD::move(__c), __a),
- comp(__comp)
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(_VSTD::move(__q.c), __a),
- comp(_VSTD::move(__q.comp))
-{
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__f, __l, __a),
- comp()
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l,
- const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__f, __l, __a),
- comp(__comp)
-{
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__c, __a),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class _Tp, class _Container, class _Compare>
-template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l, const value_compare& __comp,
- container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(_VSTD::move(__c), __a),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- _VSTD::make_heap(c.begin(), c.end(), comp);
-}
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
-{
- c.push_back(__v);
- _VSTD::push_heap(c.begin(), c.end(), comp);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
-{
- c.push_back(_VSTD::move(__v));
- _VSTD::push_heap(c.begin(), c.end(), comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-template <class... _Args>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
-{
- c.emplace_back(_VSTD::forward<_Args>(__args)...);
- _VSTD::push_heap(c.begin(), c.end(), comp);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::pop()
-{
- _VSTD::pop_heap(c.begin(), c.end(), comp);
- c.pop_back();
-}
-
-template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
- __is_nothrow_swappable<value_compare>::value)
-{
- using _VSTD::swap;
- swap(c, __q.c);
- swap(comp, __q.comp);
-}
-
-template <class _Tp, class _Container, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY
-__enable_if_t<
- __is_swappable<_Container>::value && __is_swappable<_Compare>::value,
- void
->
-swap(priority_queue<_Tp, _Container, _Compare>& __x,
- priority_queue<_Tp, _Container, _Compare>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-template <class _Tp, class _Container, class _Compare, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_QUEUE
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/ranges b/contrib/libs/cxxsupp/libcxxmsvc/include/ranges
deleted file mode 100644
index 25ed65ba1e..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/ranges
+++ /dev/null
@@ -1,269 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_RANGES
-#define _LIBCPP_RANGES
-
-/*
-
-#include <compare> // see [compare.syn]
-#include <initializer_list> // see [initializer.list.syn]
-#include <iterator> // see [iterator.synopsis]
-
-namespace std::ranges {
- inline namespace unspecified {
- // [range.access], range access
- inline constexpr unspecified begin = unspecified;
- inline constexpr unspecified end = unspecified;
- inline constexpr unspecified cbegin = unspecified;
- inline constexpr unspecified cend = unspecified;
-
- inline constexpr unspecified size = unspecified;
- inline constexpr unspecified ssize = unspecified;
- }
-
- // [range.range], ranges
- template<class T>
- concept range = see below;
-
- template<class T>
- inline constexpr bool enable_borrowed_range = false;
-
- template<class T>
- using iterator_t = decltype(ranges::begin(declval<T&>()));
- template<range R>
- using sentinel_t = decltype(ranges::end(declval<R&>()));
- template<range R>
- using range_difference_t = iter_difference_t<iterator_t<R>>;
- template<sized_range R>
- using range_size_t = decltype(ranges::size(declval<R&>()));
- template<range R>
- using range_value_t = iter_value_t<iterator_t<R>>;
- template<range R>
- using range_reference_t = iter_reference_t<iterator_t<R>>;
- template<range R>
- using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;
-
- // [range.sized], sized ranges
- template<class>
- inline constexpr bool disable_sized_range = false;
-
- template<class T>
- concept sized_range = ...;
-
- // [range.view], views
- template<class T>
- inline constexpr bool enable_view = ...;
-
- struct view_base { };
-
- template<class T>
- concept view = ...;
-
- // [range.refinements], other range refinements
- template<class R, class T>
- concept output_range = see below;
-
- template<class T>
- concept input_range = see below;
-
- template<class T>
- concept forward_range = see below;
-
- template<class T>
- concept bidirectional_range = see below;
-
- template<class T>
- concept random_access_range = see below;
-
- template<class T>
- concept contiguous_range = see below;
-
- template <class _Tp>
- concept common_range = see below;
-
- template<class T>
- concept viewable_range = see below;
-
- // [view.interface], class template view_interface
- template<class D>
- requires is_class_v<D> && same_as<D, remove_cv_t<D>>
- class view_interface;
-
- // [range.subrange], sub-ranges
- enum class subrange_kind : bool { unsized, sized };
-
- template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below>
- requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
- class subrange;
-
- template<class I, class S, subrange_kind K>
- inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;
-
- // [range.dangling], dangling iterator handling
- struct dangling;
-
- template<range R>
- using borrowed_iterator_t = see below;
-
- template<range R>
- using borrowed_subrange_t = see below;
-
- // [range.empty], empty view
- template<class T>
- requires is_object_v<T>
- class empty_view;
-
- // [range.all], all view
- namespace views {
- inline constexpr unspecified all = unspecified;
-
- template<viewable_range R>
- using all_t = decltype(all(declval<R>()));
- }
-
- template<range R>
- requires is_object_v<R>
- class ref_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<ref_view<T>> = true;
-
- template<range R>
- requires see below
- class owning_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<owning_view<T>> = enable_borrowed_range<T>;
-
- // [range.drop], drop view
- template<view V>
- class drop_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>;
-
- // [range.transform], transform view
- template<input_range V, copy_constructible F>
- requires view<V> && is_object_v<F> &&
- regular_invocable<F&, range_reference_t<V>> &&
- can-reference<invoke_result_t<F&, range_reference_t<V>>>
- class transform_view;
-
- // [range.counted], counted view
- namespace views { inline constexpr unspecified counted = unspecified; }
-
- // [range.common], common view
- template<view V>
- requires (!common_range<V> && copyable<iterator_t<V>>)
- class common_view;
-
- // [range.reverse], reverse view
- template<view V>
- requires bidirectional_range<V>
- class reverse_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<reverse_view<T>> = enable_borrowed_range<T>;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<common_view<T>> = enable_borrowed_range<T>;
-
- // [range.take], take view
- template<view> class take_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>;
-
- template<copy_constructible T>
- requires is_object_v<T>
- class single_view;
-
- template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
- requires weakly-equality-comparable-with<W, Bound> && copyable<W>
- class iota_view;
-
- template<class W, class Bound>
- inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
-
- // [range.join], join view
- template<input_range V>
- requires view<V> && input_range<range_reference_t<V>>
- class join_view;
-}
-
-namespace std {
- namespace views = ranges::views;
-
- template<class T> struct tuple_size;
- template<size_t I, class T> struct tuple_element;
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_size<ranges::subrange<I, S, K>>
- : integral_constant<size_t, 2> {};
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<0, ranges::subrange<I, S, K>> {
- using type = I;
- };
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<1, ranges::subrange<I, S, K>> {
- using type = S;
- };
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<0, const ranges::subrange<I, S, K>> {
- using type = I;
- };
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<1, const ranges::subrange<I, S, K>> {
- using type = S;
- };
-}
-*/
-
-#include <__config>
-#include <__ranges/access.h>
-#include <__ranges/all.h>
-#include <__ranges/common_view.h>
-#include <__ranges/concepts.h>
-#include <__ranges/counted.h>
-#include <__ranges/dangling.h>
-#include <__ranges/data.h>
-#include <__ranges/drop_view.h>
-#include <__ranges/empty.h>
-#include <__ranges/empty_view.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/enable_view.h>
-#include <__ranges/iota_view.h>
-#include <__ranges/join_view.h>
-#include <__ranges/rbegin.h>
-#include <__ranges/ref_view.h>
-#include <__ranges/rend.h>
-#include <__ranges/reverse_view.h>
-#include <__ranges/single_view.h>
-#include <__ranges/size.h>
-#include <__ranges/subrange.h>
-#include <__ranges/take_view.h>
-#include <__ranges/transform_view.h>
-#include <__ranges/view_interface.h>
-#include <__ranges/views.h>
-#include <compare> // Required by the standard.
-#include <initializer_list> // Required by the standard.
-#include <iterator> // Required by the standard.
-#include <type_traits>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#endif // _LIBCPP_RANGES
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/set b/contrib/libs/cxxsupp/libcxxmsvc/include/set
deleted file mode 100644
index 176369e81b..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/set
+++ /dev/null
@@ -1,1564 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SET
-#define _LIBCPP_SET
-
-/*
-
- set synopsis
-
-namespace std
-{
-
-template <class Key, class Compare = less<Key>,
- class Allocator = allocator<Key>>
-class set
-{
-public:
- // types:
- typedef Key key_type;
- typedef key_type value_type;
- typedef Compare key_compare;
- typedef key_compare value_compare;
- typedef Allocator allocator_type;
- typedef typename allocator_type::reference reference;
- typedef typename allocator_type::const_reference const_reference;
- typedef typename allocator_type::size_type size_type;
- typedef typename allocator_type::difference_type difference_type;
- typedef typename allocator_type::pointer pointer;
- typedef typename allocator_type::const_pointer const_pointer;
-
- typedef implementation-defined iterator;
- typedef implementation-defined const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef unspecified node_type; // C++17
- typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17
-
- // construct/copy/destroy:
- set()
- noexcept(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value);
- explicit set(const value_compare& comp);
- set(const value_compare& comp, const allocator_type& a);
- template <class InputIterator>
- set(InputIterator first, InputIterator last,
- const value_compare& comp = value_compare());
- template <class InputIterator>
- set(InputIterator first, InputIterator last, const value_compare& comp,
- const allocator_type& a);
- set(const set& s);
- set(set&& s)
- noexcept(
- is_nothrow_move_constructible<allocator_type>::value &&
- is_nothrow_move_constructible<key_compare>::value);
- explicit set(const allocator_type& a);
- set(const set& s, const allocator_type& a);
- set(set&& s, const allocator_type& a);
- set(initializer_list<value_type> il, const value_compare& comp = value_compare());
- set(initializer_list<value_type> il, const value_compare& comp,
- const allocator_type& a);
- template <class InputIterator>
- set(InputIterator first, InputIterator last, const allocator_type& a)
- : set(first, last, Compare(), a) {} // C++14
- set(initializer_list<value_type> il, const allocator_type& a)
- : set(il, Compare(), a) {} // C++14
- ~set();
-
- set& operator=(const set& s);
- set& operator=(set&& s)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<key_compare>::value);
- set& operator=(initializer_list<value_type> il);
-
- // iterators:
- iterator begin() noexcept;
- const_iterator begin() const noexcept;
- iterator end() noexcept;
- const_iterator end() const noexcept;
-
- reverse_iterator rbegin() noexcept;
- const_reverse_iterator rbegin() const noexcept;
- reverse_iterator rend() noexcept;
- const_reverse_iterator rend() const noexcept;
-
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
- const_reverse_iterator crbegin() const noexcept;
- const_reverse_iterator crend() const noexcept;
-
- // capacity:
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- // modifiers:
- template <class... Args>
- pair<iterator, bool> emplace(Args&&... args);
- template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- pair<iterator,bool> insert(const value_type& v);
- pair<iterator,bool> insert(value_type&& v);
- iterator insert(const_iterator position, const value_type& v);
- iterator insert(const_iterator position, value_type&& v);
- template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
- void insert(initializer_list<value_type> il);
-
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- insert_return_type insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
-
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
-
- template<class C2>
- void merge(set<Key, C2, Allocator>& source); // C++17
- template<class C2>
- void merge(set<Key, C2, Allocator>&& source); // C++17
- template<class C2>
- void merge(multiset<Key, C2, Allocator>& source); // C++17
- template<class C2>
- void merge(multiset<Key, C2, Allocator>&& source); // C++17
-
- void swap(set& s)
- noexcept(
- __is_nothrow_swappable<key_compare>::value &&
- (!allocator_type::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value));
-
- // observers:
- allocator_type get_allocator() const noexcept;
- key_compare key_comp() const;
- value_compare value_comp() const;
-
- // set operations:
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
- template<typename K>
- iterator find(const K& x);
- template<typename K>
- const_iterator find(const K& x) const; // C++14
-
- template<typename K>
- size_type count(const K& x) const; // C++14
- size_type count(const key_type& k) const;
-
- bool contains(const key_type& x) const; // C++20
- template<class K> bool contains(const K& x) const; // C++20
-
- iterator lower_bound(const key_type& k);
- const_iterator lower_bound(const key_type& k) const;
- template<typename K>
- iterator lower_bound(const K& x); // C++14
- template<typename K>
- const_iterator lower_bound(const K& x) const; // C++14
-
- iterator upper_bound(const key_type& k);
- const_iterator upper_bound(const key_type& k) const;
- template<typename K>
- iterator upper_bound(const K& x); // C++14
- template<typename K>
- const_iterator upper_bound(const K& x) const; // C++14
- pair<iterator,iterator> equal_range(const key_type& k);
- pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
- template<typename K>
- pair<iterator,iterator> equal_range(const K& x); // C++14
- template<typename K>
- pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
-};
-
-template <class InputIterator,
- class Compare = less<typename iterator_traits<InputIterator>::value_type>,
- class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
-set(InputIterator, InputIterator,
- Compare = Compare(), Allocator = Allocator())
- -> set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>; // C++17
-
-template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
-set(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
- -> set<Key, Compare, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-set(InputIterator, InputIterator, Allocator)
- -> set<typename iterator_traits<InputIterator>::value_type,
- less<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17
-
-template<class Key, class Allocator>
-set(initializer_list<Key>, Allocator) -> set<Key, less<Key>, Allocator>; // C++17
-
-template <class Key, class Compare, class Allocator>
-bool
-operator==(const set<Key, Compare, Allocator>& x,
- const set<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator< (const set<Key, Compare, Allocator>& x,
- const set<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator!=(const set<Key, Compare, Allocator>& x,
- const set<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator> (const set<Key, Compare, Allocator>& x,
- const set<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator>=(const set<Key, Compare, Allocator>& x,
- const set<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator<=(const set<Key, Compare, Allocator>& x,
- const set<Key, Compare, Allocator>& y);
-
-// specialized algorithms:
-template <class Key, class Compare, class Allocator>
-void
-swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class Key, class Compare, class Allocator, class Predicate>
-typename set<Key, Compare, Allocator>::size_type
-erase_if(set<Key, Compare, Allocator>& c, Predicate pred); // C++20
-
-template <class Key, class Compare = less<Key>,
- class Allocator = allocator<Key>>
-class multiset
-{
-public:
- // types:
- typedef Key key_type;
- typedef key_type value_type;
- typedef Compare key_compare;
- typedef key_compare value_compare;
- typedef Allocator allocator_type;
- typedef typename allocator_type::reference reference;
- typedef typename allocator_type::const_reference const_reference;
- typedef typename allocator_type::size_type size_type;
- typedef typename allocator_type::difference_type difference_type;
- typedef typename allocator_type::pointer pointer;
- typedef typename allocator_type::const_pointer const_pointer;
-
- typedef implementation-defined iterator;
- typedef implementation-defined const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef unspecified node_type; // C++17
-
- // construct/copy/destroy:
- multiset()
- noexcept(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value);
- explicit multiset(const value_compare& comp);
- multiset(const value_compare& comp, const allocator_type& a);
- template <class InputIterator>
- multiset(InputIterator first, InputIterator last,
- const value_compare& comp = value_compare());
- template <class InputIterator>
- multiset(InputIterator first, InputIterator last,
- const value_compare& comp, const allocator_type& a);
- multiset(const multiset& s);
- multiset(multiset&& s)
- noexcept(
- is_nothrow_move_constructible<allocator_type>::value &&
- is_nothrow_move_constructible<key_compare>::value);
- explicit multiset(const allocator_type& a);
- multiset(const multiset& s, const allocator_type& a);
- multiset(multiset&& s, const allocator_type& a);
- multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
- multiset(initializer_list<value_type> il, const value_compare& comp,
- const allocator_type& a);
- template <class InputIterator>
- multiset(InputIterator first, InputIterator last, const allocator_type& a)
- : set(first, last, Compare(), a) {} // C++14
- multiset(initializer_list<value_type> il, const allocator_type& a)
- : set(il, Compare(), a) {} // C++14
- ~multiset();
-
- multiset& operator=(const multiset& s);
- multiset& operator=(multiset&& s)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<key_compare>::value);
- multiset& operator=(initializer_list<value_type> il);
-
- // iterators:
- iterator begin() noexcept;
- const_iterator begin() const noexcept;
- iterator end() noexcept;
- const_iterator end() const noexcept;
-
- reverse_iterator rbegin() noexcept;
- const_reverse_iterator rbegin() const noexcept;
- reverse_iterator rend() noexcept;
- const_reverse_iterator rend() const noexcept;
-
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
- const_reverse_iterator crbegin() const noexcept;
- const_reverse_iterator crend() const noexcept;
-
- // capacity:
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- // modifiers:
- template <class... Args>
- iterator emplace(Args&&... args);
- template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- iterator insert(const value_type& v);
- iterator insert(value_type&& v);
- iterator insert(const_iterator position, const value_type& v);
- iterator insert(const_iterator position, value_type&& v);
- template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
- void insert(initializer_list<value_type> il);
-
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- iterator insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
-
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
-
- template<class C2>
- void merge(multiset<Key, C2, Allocator>& source); // C++17
- template<class C2>
- void merge(multiset<Key, C2, Allocator>&& source); // C++17
- template<class C2>
- void merge(set<Key, C2, Allocator>& source); // C++17
- template<class C2>
- void merge(set<Key, C2, Allocator>&& source); // C++17
-
- void swap(multiset& s)
- noexcept(
- __is_nothrow_swappable<key_compare>::value &&
- (!allocator_type::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value));
-
- // observers:
- allocator_type get_allocator() const noexcept;
- key_compare key_comp() const;
- value_compare value_comp() const;
-
- // set operations:
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
- template<typename K>
- iterator find(const K& x);
- template<typename K>
- const_iterator find(const K& x) const; // C++14
-
- template<typename K>
- size_type count(const K& x) const; // C++14
- size_type count(const key_type& k) const;
-
- bool contains(const key_type& x) const; // C++20
- template<class K> bool contains(const K& x) const; // C++20
-
- iterator lower_bound(const key_type& k);
- const_iterator lower_bound(const key_type& k) const;
- template<typename K>
- iterator lower_bound(const K& x); // C++14
- template<typename K>
- const_iterator lower_bound(const K& x) const; // C++14
-
- iterator upper_bound(const key_type& k);
- const_iterator upper_bound(const key_type& k) const;
- template<typename K>
- iterator upper_bound(const K& x); // C++14
- template<typename K>
- const_iterator upper_bound(const K& x) const; // C++14
-
- pair<iterator,iterator> equal_range(const key_type& k);
- pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
- template<typename K>
- pair<iterator,iterator> equal_range(const K& x); // C++14
- template<typename K>
- pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
-};
-
-template <class InputIterator,
- class Compare = less<typename iterator_traits<InputIterator>::value_type>,
- class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
-multiset(InputIterator, InputIterator,
- Compare = Compare(), Allocator = Allocator())
- -> multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>; // C++17
-
-template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
-multiset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
- -> multiset<Key, Compare, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-multiset(InputIterator, InputIterator, Allocator)
- -> multiset<typename iterator_traits<InputIterator>::value_type,
- less<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17
-
-template<class Key, class Allocator>
-multiset(initializer_list<Key>, Allocator) -> multiset<Key, less<Key>, Allocator>; // C++17
-
-template <class Key, class Compare, class Allocator>
-bool
-operator==(const multiset<Key, Compare, Allocator>& x,
- const multiset<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator< (const multiset<Key, Compare, Allocator>& x,
- const multiset<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator!=(const multiset<Key, Compare, Allocator>& x,
- const multiset<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator> (const multiset<Key, Compare, Allocator>& x,
- const multiset<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator>=(const multiset<Key, Compare, Allocator>& x,
- const multiset<Key, Compare, Allocator>& y);
-
-template <class Key, class Compare, class Allocator>
-bool
-operator<=(const multiset<Key, Compare, Allocator>& x,
- const multiset<Key, Compare, Allocator>& y);
-
-// specialized algorithms:
-template <class Key, class Compare, class Allocator>
-void
-swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class Key, class Compare, class Allocator, class Predicate>
-typename multiset<Key, Compare, Allocator>::size_type
-erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
-
-} // std
-
-*/
-
-#include <__algorithm/equal.h>
-#include <__algorithm/lexicographical_compare.h>
-#include <__assert>
-#include <__config>
-#include <__functional/is_transparent.h>
-#include <__iterator/iterator_traits.h>
-#include <__node_handle>
-#include <__tree>
-#include <__utility/forward.h>
-#include <compare>
-#include <functional>
-#include <initializer_list>
-#include <iterator> // __libcpp_erase_if_container
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Key, class _Compare, class _Allocator>
-class multiset;
-
-template <class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key> >
-class _LIBCPP_TEMPLATE_VIS set
-{
-public:
- // types:
- typedef _Key key_type;
- typedef key_type value_type;
- typedef __identity_t<_Compare> key_compare;
- typedef key_compare value_compare;
- typedef __identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
-private:
- typedef __tree<value_type, value_compare, allocator_type> __base;
- typedef allocator_traits<allocator_type> __alloc_traits;
-
- __base __tree_;
-
-public:
- typedef typename __base::pointer pointer;
- typedef typename __base::const_pointer const_pointer;
- typedef typename __base::size_type size_type;
- typedef typename __base::difference_type difference_type;
- typedef typename __base::const_iterator iterator;
- typedef typename __base::const_iterator const_iterator;
- typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
- typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
-
-#if _LIBCPP_STD_VER > 14
- typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
-#endif
-
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS set;
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multiset;
-
- _LIBCPP_INLINE_VISIBILITY
- set()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(value_compare()) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit set(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__comp) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit set(const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a) {}
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- set(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__f, __l);
- }
-
-#if _LIBCPP_STD_VER > 11
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : set(__f, __l, key_compare(), __a) {}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- set(const set& __s)
- : __tree_(__s.__tree_)
- {
- insert(__s.begin(), __s.end());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- set& operator=(const set& __s)
- {
- __tree_ = __s.__tree_;
- return *this;
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- set(set&& __s)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(_VSTD::move(__s.__tree_)) {}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- explicit set(const allocator_type& __a)
- : __tree_(__a) {}
-
- _LIBCPP_INLINE_VISIBILITY
- set(const set& __s, const allocator_type& __a)
- : __tree_(__s.__tree_.value_comp(), __a)
- {
- insert(__s.begin(), __s.end());
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- set(set&& __s, const allocator_type& __a);
-
- _LIBCPP_INLINE_VISIBILITY
- set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- set(initializer_list<value_type> __il, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__il.begin(), __il.end());
- }
-
-#if _LIBCPP_STD_VER > 11
- _LIBCPP_INLINE_VISIBILITY
- set(initializer_list<value_type> __il, const allocator_type& __a)
- : set(__il, key_compare(), __a) {}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- set& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_unique(__il.begin(), __il.end());
- return *this;
- }
-
- _LIBCPP_INLINE_VISIBILITY
- set& operator=(set&& __s)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = _VSTD::move(__s.__tree_);
- return *this;
- }
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- ~set() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_INLINE_VISIBILITY
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
-
- // modifiers:
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> emplace(_Args&&... __args)
- {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator,bool> insert(const value_type& __v)
- {return __tree_.__insert_unique(__v);}
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_unique(__p, __v);}
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_unique(__e, *__f);
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator,bool> insert(value_type&& __v)
- {return __tree_.__insert_unique(_VSTD::move(__v));}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
-
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __p) {return __tree_.erase(__p);}
- _LIBCPP_INLINE_VISIBILITY
- size_type erase(const key_type& __k)
- {return __tree_.__erase_unique(__k);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f, __l);}
- _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {__tree_.clear();}
-
-#if _LIBCPP_STD_VER > 14
- _LIBCPP_INLINE_VISIBILITY
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to set::insert()");
- return __tree_.template __node_handle_insert_unique<
- node_type, insert_return_type>(_VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to set::insert()");
- return __tree_.template __node_handle_insert_unique<node_type>(
- __hint, _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(set<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(set<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(multiset<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__s.__tree_);}
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
- _LIBCPP_INLINE_VISIBILITY
- key_compare key_comp() const {return __tree_.value_comp();}
- _LIBCPP_INLINE_VISIBILITY
- value_compare value_comp() const {return __tree_.value_comp();}
-
- // set operations:
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
- find(const _K2& __k) const {return __tree_.find(__k);}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const key_type& __k) const
- {return __tree_.__count_unique(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
-#endif
-
-#if _LIBCPP_STD_VER > 17
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
- contains(const _K2& __k) const { return find(__k) != end(); }
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_unique(__k);}
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_unique(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
-#endif
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
-set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
-
-template<class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<_Key, _Compare, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(_InputIterator, _InputIterator, _Allocator)
- -> set<__iter_value_type<_InputIterator>,
- less<__iter_value_type<_InputIterator>>, _Allocator>;
-
-template<class _Key, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(initializer_list<_Key>, _Allocator)
- -> set<_Key, less<_Key>, _Allocator>;
-#endif
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Compare, class _Allocator>
-set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
- : __tree_(_VSTD::move(__s.__tree_), __a)
-{
- if (__a != __s.get_allocator())
- {
- const_iterator __e = cend();
- while (!__s.empty())
- insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
- }
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator< (const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator> (const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return __y < __x;
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator>=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator<=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
-}
-
-// specialized algorithms:
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(set<_Key, _Compare, _Allocator>& __x,
- set<_Key, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename set<_Key, _Compare, _Allocator>::size_type
- erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
- return _VSTD::__libcpp_erase_if_container(__c, __pred);
-}
-#endif
-
-template <class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key> >
-class _LIBCPP_TEMPLATE_VIS multiset
-{
-public:
- // types:
- typedef _Key key_type;
- typedef key_type value_type;
- typedef __identity_t<_Compare> key_compare;
- typedef key_compare value_compare;
- typedef __identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
-private:
- typedef __tree<value_type, value_compare, allocator_type> __base;
- typedef allocator_traits<allocator_type> __alloc_traits;
-
- __base __tree_;
-
-public:
- typedef typename __base::pointer pointer;
- typedef typename __base::const_pointer const_pointer;
- typedef typename __base::size_type size_type;
- typedef typename __base::difference_type difference_type;
- typedef typename __base::const_iterator iterator;
- typedef typename __base::const_iterator const_iterator;
- typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
- typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
-
-#if _LIBCPP_STD_VER > 14
- typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
-#endif
-
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS set;
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multiset;
-
- // construct/copy/destroy:
- _LIBCPP_INLINE_VISIBILITY
- multiset()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(value_compare()) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit multiset(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__comp) {}
-
- _LIBCPP_INLINE_VISIBILITY
- explicit multiset(const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a) {}
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- multiset(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__f, __l);
- }
-
-#if _LIBCPP_STD_VER > 11
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : multiset(__f, __l, key_compare(), __a) {}
-#endif
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- multiset(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__f, __l);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- multiset(const multiset& __s)
- : __tree_(__s.__tree_.value_comp(),
- __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
- {
- insert(__s.begin(), __s.end());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- multiset& operator=(const multiset& __s)
- {
- __tree_ = __s.__tree_;
- return *this;
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- multiset(multiset&& __s)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(_VSTD::move(__s.__tree_)) {}
-
- multiset(multiset&& __s, const allocator_type& __a);
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- explicit multiset(const allocator_type& __a)
- : __tree_(__a) {}
- _LIBCPP_INLINE_VISIBILITY
- multiset(const multiset& __s, const allocator_type& __a)
- : __tree_(__s.__tree_.value_comp(), __a)
- {
- insert(__s.begin(), __s.end());
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_INLINE_VISIBILITY
- multiset(initializer_list<value_type> __il, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__il.begin(), __il.end());
- }
-
-#if _LIBCPP_STD_VER > 11
- _LIBCPP_INLINE_VISIBILITY
- multiset(initializer_list<value_type> __il, const allocator_type& __a)
- : multiset(__il, key_compare(), __a) {}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- multiset& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_multi(__il.begin(), __il.end());
- return *this;
- }
-
- _LIBCPP_INLINE_VISIBILITY
- multiset& operator=(multiset&& __s)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = _VSTD::move(__s.__tree_);
- return *this;
- }
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- ~multiset() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_INLINE_VISIBILITY
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_INLINE_VISIBILITY
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
-
- // modifiers:
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace(_Args&&... __args)
- {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const value_type& __v)
- {return __tree_.__insert_multi(__v);}
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_multi(__p, __v);}
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_multi(__e, *__f);
- }
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(value_type&& __v)
- {return __tree_.__insert_multi(_VSTD::move(__v));}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_multi(__p, _VSTD::move(__v));}
-
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __p) {return __tree_.erase(__p);}
- _LIBCPP_INLINE_VISIBILITY
- size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f, __l);}
- _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {__tree_.clear();}
-
-#if _LIBCPP_STD_VER > 14
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multiset::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multiset::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- __hint, _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(multiset<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(set<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(set<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(multiset& __s)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__s.__tree_);}
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
- _LIBCPP_INLINE_VISIBILITY
- key_compare key_comp() const {return __tree_.value_comp();}
- _LIBCPP_INLINE_VISIBILITY
- value_compare value_comp() const {return __tree_.value_comp();}
-
- // set operations:
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
- find(const _K2& __k) const {return __tree_.find(__k);}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const key_type& __k) const
- {return __tree_.__count_multi(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
-#endif
-
-#if _LIBCPP_STD_VER > 17
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
- contains(const _K2& __k) const { return find(__k) != end(); }
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_multi(__k);}
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_multi(__k);}
-#if _LIBCPP_STD_VER > 11
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
-#endif
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
-multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
-
-template<class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
-multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<_Key, _Compare, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multiset(_InputIterator, _InputIterator, _Allocator)
- -> multiset<__iter_value_type<_InputIterator>,
- less<__iter_value_type<_InputIterator>>, _Allocator>;
-
-template<class _Key, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multiset(initializer_list<_Key>, _Allocator)
- -> multiset<_Key, less<_Key>, _Allocator>;
-#endif
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Compare, class _Allocator>
-multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
- : __tree_(_VSTD::move(__s.__tree_), __a)
-{
- if (__a != __s.get_allocator())
- {
- const_iterator __e = cend();
- while (!__s.empty())
- insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
- }
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator< (const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator> (const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return __y < __x;
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
-}
-
-template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(multiset<_Key, _Compare, _Allocator>& __x,
- multiset<_Key, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename multiset<_Key, _Compare, _Allocator>::size_type
- erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
- return _VSTD::__libcpp_erase_if_container(__c, __pred);
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_SET
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h b/contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h
deleted file mode 100644
index fca41aa31b..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SETJMP_H
-#define _LIBCPP_SETJMP_H
-
-/*
- setjmp.h synopsis
-
-Macros:
-
- setjmp
-
-Types:
-
- jmp_buf
-
-void longjmp(jmp_buf env, int val);
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifdef _LIBCPP_COMPILER_MSVC
-#include Y_MSVC_INCLUDE_NEXT(setjmp.h)
-#else
-#include_next <setjmp.h>
-#endif
-
-#ifdef __cplusplus
-
-#ifndef setjmp
-#define setjmp(env) setjmp(env)
-#endif
-
-#endif // __cplusplus
-
-#endif // _LIBCPP_SETJMP_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/span b/contrib/libs/cxxsupp/libcxxmsvc/include/span
deleted file mode 100644
index 0101dcb822..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/span
+++ /dev/null
@@ -1,658 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SPAN
-#define _LIBCPP_SPAN
-
-/*
- span synopsis
-
-namespace std {
-
-// constants
-inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-
-// [views.span], class template span
-template <class ElementType, size_t Extent = dynamic_extent>
- class span;
-
-template<class ElementType, size_t Extent>
- inline constexpr bool ranges::enable_view<span<ElementType, Extent>> = true;
-
-template<class ElementType, size_t Extent>
- inline constexpr bool ranges::enable_borrowed_range<span<ElementType, Extent>> = true;
-
-// [span.objectrep], views of object representation
-template <class ElementType, size_t Extent>
- span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
- (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
-
-template <class ElementType, size_t Extent>
- span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
- (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
-
-
-template <class ElementType, size_t Extent = dynamic_extent>
-class span {
-public:
- // constants and types
- using element_type = ElementType;
- using value_type = remove_cv_t<ElementType>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = element_type*;
- using const_pointer = const element_type*;
- using reference = element_type&;
- using const_reference = const element_type&;
- using iterator = implementation-defined;
- using reverse_iterator = std::reverse_iterator<iterator>;
- static constexpr size_type extent = Extent;
-
- // [span.cons], span constructors, copy, assignment, and destructor
- constexpr span() noexcept;
- template <class It>
- constexpr explicit(Extent != dynamic_extent) span(It first, size_type count);
- template <class It, class End>
- constexpr explicit(Extent != dynamic_extent) span(It first, End last);
- template <size_t N>
- constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
- template <size_t N>
- constexpr span(array<value_type, N>& arr) noexcept;
- template <size_t N>
- constexpr span(const array<value_type, N>& arr) noexcept;
- template<class R>
- constexpr explicit(Extent != dynamic_extent) span(R&& r);
- constexpr span(const span& other) noexcept = default;
- template <class OtherElementType, size_t OtherExtent>
- constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept;
- ~span() noexcept = default;
- constexpr span& operator=(const span& other) noexcept = default;
-
- // [span.sub], span subviews
- template <size_t Count>
- constexpr span<element_type, Count> first() const;
- template <size_t Count>
- constexpr span<element_type, Count> last() const;
- template <size_t Offset, size_t Count = dynamic_extent>
- constexpr span<element_type, see below> subspan() const;
-
- constexpr span<element_type, dynamic_extent> first(size_type count) const;
- constexpr span<element_type, dynamic_extent> last(size_type count) const;
- constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_extent) const;
-
- // [span.obs], span observers
- constexpr size_type size() const noexcept;
- constexpr size_type size_bytes() const noexcept;
- [[nodiscard]] constexpr bool empty() const noexcept;
-
- // [span.elem], span element access
- constexpr reference operator[](size_type idx) const;
- constexpr reference front() const;
- constexpr reference back() const;
- constexpr pointer data() const noexcept;
-
- // [span.iterators], span iterator support
- constexpr iterator begin() const noexcept;
- constexpr iterator end() const noexcept;
- constexpr reverse_iterator rbegin() const noexcept;
- constexpr reverse_iterator rend() const noexcept;
-
-private:
- pointer data_; // exposition only
- size_type size_; // exposition only
-};
-
-template<class It, class EndOrSize>
- span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
-
-template<class T, size_t N>
- span(T (&)[N]) -> span<T, N>;
-
-template<class T, size_t N>
- span(array<T, N>&) -> span<T, N>;
-
-template<class T, size_t N>
- span(const array<T, N>&) -> span<const T, N>;
-
-template<class R>
- span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>;
-
-} // namespace std
-
-*/
-
-#include <__assert>
-#include <__config>
-#include <__debug>
-#include <__iterator/concepts.h>
-#include <__iterator/wrap_iter.h>
-#include <__ranges/concepts.h>
-#include <__ranges/data.h>
-#include <__ranges/enable_borrowed_range.h>
-#include <__ranges/enable_view.h>
-#include <__ranges/size.h>
-#include <array> // for array
-#include <cstddef> // for byte
-#include <iterator> // for iterators
-#include <limits>
-#include <type_traits> // for remove_cv, etc
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER > 17
-
-inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-template <typename _Tp, size_t _Extent = dynamic_extent> class span;
-
-
-template <class _Tp>
-struct __is_std_array : false_type {};
-
-template <class _Tp, size_t _Sz>
-struct __is_std_array<array<_Tp, _Sz>> : true_type {};
-
-template <class _Tp>
-struct __is_std_span : false_type {};
-
-template <class _Tp, size_t _Sz>
-struct __is_std_span<span<_Tp, _Sz>> : true_type {};
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-template <class _Range, class _ElementType>
-concept __span_compatible_range =
- ranges::contiguous_range<_Range> &&
- ranges::sized_range<_Range> &&
- (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) &&
- !__is_std_span<remove_cvref_t<_Range>>::value &&
- !__is_std_array<remove_cvref_t<_Range>>::value &&
- !is_array_v<remove_cvref_t<_Range>> &&
- is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>;
-#else
-template <class _Tp, class _ElementType, class = void>
-struct __is_span_compatible_container : public false_type {};
-
-template <class _Tp, class _ElementType>
-struct __is_span_compatible_container<_Tp, _ElementType,
- void_t<
- // is not a specialization of span
- enable_if_t<!__is_std_span<_Tp>::value, nullptr_t>,
- // is not a specialization of array
- enable_if_t<!__is_std_array<_Tp>::value, nullptr_t>,
- // is_array_v<Container> is false,
- enable_if_t<!is_array_v<_Tp>, nullptr_t>,
- // data(cont) and size(cont) are well formed
- decltype(data(declval<_Tp>())),
- decltype(size(declval<_Tp>())),
- // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to ElementType(*)[]
- enable_if_t<
- is_convertible_v<remove_pointer_t<decltype(data(declval<_Tp &>()))>(*)[],
- _ElementType(*)[]>,
- nullptr_t>
- >>
- : public true_type {};
-#endif
-
-template <typename _Tp, size_t _Extent>
-class _LIBCPP_TEMPLATE_VIS span {
-public:
-// constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp *;
- using const_pointer = const _Tp *;
- using reference = _Tp &;
- using const_reference = const _Tp &;
-#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
- using iterator = pointer;
-#else
- using iterator = __wrap_iter<pointer>;
-#endif
- using reverse_iterator = _VSTD::reverse_iterator<iterator>;
-
- static constexpr size_type extent = _Extent;
-
-// [span.cons], span constructors, copy, assignment, and destructor
- template <size_t _Sz = _Extent, enable_if_t<_Sz == 0, nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {}
-
- constexpr span (const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
- template <class _It,
- enable_if_t<contiguous_iterator<_It> &&
- is_convertible_v<remove_reference_t<iter_reference_t<_It>>(*)[], element_type (*)[]>,
- nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr explicit span(_It __first, size_type __count)
- : __data{_VSTD::to_address(__first)} {
- (void)__count;
- _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
- }
-
- template <
- class _It, class _End,
- enable_if_t<is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]> &&
- contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>,
- nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr explicit span(_It __first, _End __last) : __data{_VSTD::to_address(__first)} {
- (void)__last;
- _LIBCPP_ASSERT((__last - __first >= 0), "invalid range in span's constructor (iterator, sentinel)");
- _LIBCPP_ASSERT(__last - __first == _Extent,
- "invalid range in span's constructor (iterator, sentinel): last - first != extent");
- }
-#else
- _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __ptr, size_type __count) : __data{__ptr}
- { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); }
- _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l) : __data{__f}
- { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); }
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
- _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {}
-
- template <class _OtherElementType,
- enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {}
-
- template <class _OtherElementType,
- enable_if_t<is_convertible_v<const _OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {}
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_INLINE_VISIBILITY
- constexpr explicit span(_Range&& __r) : __data{ranges::data(__r)} {
- _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
- }
-#else
- template <class _Container>
- _LIBCPP_INLINE_VISIBILITY
- constexpr explicit span( _Container& __c,
- enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
- : __data{_VSTD::data(__c)} {
- _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)");
- }
-
- template <class _Container>
- _LIBCPP_INLINE_VISIBILITY
- constexpr explicit span(const _Container& __c,
- enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
- : __data{_VSTD::data(__c)} {
- _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)");
- }
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
- template <class _OtherElementType>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(const span<_OtherElementType, _Extent>& __other,
- enable_if_t<
- is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
- nullptr_t> = nullptr)
- : __data{__other.data()} {}
-
- template <class _OtherElementType>
- _LIBCPP_INLINE_VISIBILITY
- constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other,
- enable_if_t<
- is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
- nullptr_t> = nullptr) noexcept
- : __data{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); }
-
-
-// ~span() noexcept = default;
-
- template <size_t _Count>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, _Count> first() const noexcept
- {
- static_assert(_Count <= _Extent, "Count out of range in span::first()");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, _Count> last() const noexcept
- {
- static_assert(_Count <= _Extent, "Count out of range in span::last()");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
- return {data(), __count};
- }
-
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_INLINE_VISIBILITY
- constexpr auto subspan() const noexcept
- -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
- {
- static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
- static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "Offset + count out of range in span::subspan()");
-
- using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
- return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
-
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, dynamic_extent>
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
- {
- _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
- _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset, count)");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; }
- _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
-
- _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
- {
- _LIBCPP_ASSERT(__idx < size(), "span<T,N>[] index out of bounds");
- return __data[__idx];
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
- {
- _LIBCPP_ASSERT(!empty(), "span<T, N>::front() on empty span");
- return __data[0];
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
- {
- _LIBCPP_ASSERT(!empty(), "span<T, N>::back() on empty span");
- return __data[size()-1];
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
-
-// [span.iter], span iterator support
- _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); }
- _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); }
- _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
- { return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte *>(data()), size_bytes()}; }
-
- _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept
- { return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()}; }
-
-private:
- pointer __data;
-
-};
-
-
-template <typename _Tp>
-class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
-private:
-
-public:
-// constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp *;
- using const_pointer = const _Tp *;
- using reference = _Tp &;
- using const_reference = const _Tp &;
-#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
- using iterator = pointer;
-#else
- using iterator = __wrap_iter<pointer>;
-#endif
- using reverse_iterator = _VSTD::reverse_iterator<iterator>;
-
- static constexpr size_type extent = dynamic_extent;
-
-// [span.cons], span constructors, copy, assignment, and destructor
- _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {}
-
- constexpr span (const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
- template <class _It,
- enable_if_t<contiguous_iterator<_It> &&
- is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]>,
- nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(_It __first, size_type __count)
- : __data{_VSTD::to_address(__first)}, __size{__count} {}
-
- template <
- class _It, class _End,
- enable_if_t<is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]> &&
- contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>,
- nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(_It __first, _End __last)
- : __data(_VSTD::to_address(__first)), __size(__last - __first) {}
-#else
- _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {}
- _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
- template <size_t _Sz>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
-
- template <class _OtherElementType, size_t _Sz,
- enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
-
- template <class _OtherElementType, size_t _Sz,
- enable_if_t<is_convertible_v<const _OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {}
-#else
- template <class _Container>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span( _Container& __c,
- enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
- : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {}
-
- template <class _Container>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(const _Container& __c,
- enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
- : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {}
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
- template <class _OtherElementType, size_t _OtherExtent>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
- enable_if_t<
- is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
- nullptr_t> = nullptr) noexcept
- : __data{__other.data()}, __size{__other.size()} {}
-
-// ~span() noexcept = default;
-
- template <size_t _Count>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, _Count> first() const noexcept
- {
- _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, _Count> last() const noexcept
- {
- _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
- return {data(), __count};
- }
-
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
- {
- _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span<element_type, _Count> subspan() const noexcept
- {
- _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()");
- _LIBCPP_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "Offset + count out of range in span::subspan()");
- return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
- constexpr span<element_type, dynamic_extent>
- _LIBCPP_INLINE_VISIBILITY
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
- {
- _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
- _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset, count)");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; }
- _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; }
-
- _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
- {
- _LIBCPP_ASSERT(__idx < size(), "span<T>[] index out of bounds");
- return __data[__idx];
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
- {
- _LIBCPP_ASSERT(!empty(), "span<T>[].front() on empty span");
- return __data[0];
- }
-
- _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
- {
- _LIBCPP_ASSERT(!empty(), "span<T>[].back() on empty span");
- return __data[size()-1];
- }
-
-
- _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
-
-// [span.iter], span iterator support
- _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); }
- _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); }
- _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept;
-
- inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept;
-
-private:
- pointer __data;
- size_type __size;
-};
-
-template<typename _Tp>
-inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_bytes() const noexcept
-{ return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
-
-template<typename _Tp>
-inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_writable_bytes() const noexcept
-{ return {reinterpret_cast<byte *>(data()), size_bytes()}; }
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
-template <class _Tp, size_t _Extent>
-inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true;
-
-template <class _ElementType, size_t _Extent>
-inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-// as_bytes & as_writable_bytes
-template <class _Tp, size_t _Extent>
-_LIBCPP_INLINE_VISIBILITY
-auto as_bytes(span<_Tp, _Extent> __s) noexcept
--> decltype(__s.__as_bytes())
-{ return __s.__as_bytes(); }
-
-template <class _Tp, size_t _Extent>
-_LIBCPP_INLINE_VISIBILITY
-auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
--> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())>
-{ return __s.__as_writable_bytes(); }
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
-template<contiguous_iterator _It, class _EndOrSize>
- span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-template<class _Tp, size_t _Sz>
- span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
-
-template<class _Tp, size_t _Sz>
- span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
-
-template<class _Tp, size_t _Sz>
- span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
-
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-template<ranges::contiguous_range _Range>
- span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
-#endif
-
-#endif // _LIBCPP_STD_VER > 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_SPAN
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h b/contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h
deleted file mode 100644
index d9550c4406..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_STDATOMIC_H
-#define _LIBCPP_STDATOMIC_H
-
-/*
- stdatomic.h synopsis
-
-template<class T>
- using std-atomic = std::atomic<T>; // exposition only
-
-#define _Atomic(T) std-atomic<T>
-
-#define ATOMIC_BOOL_LOCK_FREE see below
-#define ATOMIC_CHAR_LOCK_FREE see below
-#define ATOMIC_CHAR16_T_LOCK_FREE see below
-#define ATOMIC_CHAR32_T_LOCK_FREE see below
-#define ATOMIC_WCHAR_T_LOCK_FREE see below
-#define ATOMIC_SHORT_LOCK_FREE see below
-#define ATOMIC_INT_LOCK_FREE see below
-#define ATOMIC_LONG_LOCK_FREE see below
-#define ATOMIC_LLONG_LOCK_FREE see below
-#define ATOMIC_POINTER_LOCK_FREE see below
-
-using std::memory_order // see below
-using std::memory_order_relaxed // see below
-using std::memory_order_consume // see below
-using std::memory_order_acquire // see below
-using std::memory_order_release // see below
-using std::memory_order_acq_rel // see below
-using std::memory_order_seq_cst // see below
-
-using std::atomic_flag // see below
-
-using std::atomic_bool // see below
-using std::atomic_char // see below
-using std::atomic_schar // see below
-using std::atomic_uchar // see below
-using std::atomic_short // see below
-using std::atomic_ushort // see below
-using std::atomic_int // see below
-using std::atomic_uint // see below
-using std::atomic_long // see below
-using std::atomic_ulong // see below
-using std::atomic_llong // see below
-using std::atomic_ullong // see below
-using std::atomic_char8_t // see below
-using std::atomic_char16_t // see below
-using std::atomic_char32_t // see below
-using std::atomic_wchar_t // see below
-using std::atomic_int8_t // see below
-using std::atomic_uint8_t // see below
-using std::atomic_int16_t // see below
-using std::atomic_uint16_t // see below
-using std::atomic_int32_t // see below
-using std::atomic_uint32_t // see below
-using std::atomic_int64_t // see below
-using std::atomic_uint64_t // see below
-using std::atomic_int_least8_t // see below
-using std::atomic_uint_least8_t // see below
-using std::atomic_int_least16_t // see below
-using std::atomic_uint_least16_t // see below
-using std::atomic_int_least32_t // see below
-using std::atomic_uint_least32_t // see below
-using std::atomic_int_least64_t // see below
-using std::atomic_uint_least64_t // see below
-using std::atomic_int_fast8_t // see below
-using std::atomic_uint_fast8_t // see below
-using std::atomic_int_fast16_t // see below
-using std::atomic_uint_fast16_t // see below
-using std::atomic_int_fast32_t // see below
-using std::atomic_uint_fast32_t // see below
-using std::atomic_int_fast64_t // see below
-using std::atomic_uint_fast64_t // see below
-using std::atomic_intptr_t // see below
-using std::atomic_uintptr_t // see below
-using std::atomic_size_t // see below
-using std::atomic_ptrdiff_t // see below
-using std::atomic_intmax_t // see below
-using std::atomic_uintmax_t // see below
-
-using std::atomic_is_lock_free // see below
-using std::atomic_load // see below
-using std::atomic_load_explicit // see below
-using std::atomic_store // see below
-using std::atomic_store_explicit // see below
-using std::atomic_exchange // see below
-using std::atomic_exchange_explicit // see below
-using std::atomic_compare_exchange_strong // see below
-using std::atomic_compare_exchange_strong_explicit // see below
-using std::atomic_compare_exchange_weak // see below
-using std::atomic_compare_exchange_weak_explicit // see below
-using std::atomic_fetch_add // see below
-using std::atomic_fetch_add_explicit // see below
-using std::atomic_fetch_sub // see below
-using std::atomic_fetch_sub_explicit // see below
-using std::atomic_fetch_or // see below
-using std::atomic_fetch_or_explicit // see below
-using std::atomic_fetch_and // see below
-using std::atomic_fetch_and_explicit // see below
-using std::atomic_flag_test_and_set // see below
-using std::atomic_flag_test_and_set_explicit // see below
-using std::atomic_flag_clear // see below
-using std::atomic_flag_clear_explicit // see below
-
-using std::atomic_thread_fence // see below
-using std::atomic_signal_fence // see below
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER > 20
-
-#include <atomic>
-#include <version>
-
-#ifdef _Atomic
-# undef _Atomic
-#endif
-
-#define _Atomic(_Tp) ::std::atomic<_Tp>
-
-using std::memory_order _LIBCPP_USING_IF_EXISTS;
-using std::memory_order_relaxed _LIBCPP_USING_IF_EXISTS;
-using std::memory_order_consume _LIBCPP_USING_IF_EXISTS;
-using std::memory_order_acquire _LIBCPP_USING_IF_EXISTS;
-using std::memory_order_release _LIBCPP_USING_IF_EXISTS;
-using std::memory_order_acq_rel _LIBCPP_USING_IF_EXISTS;
-using std::memory_order_seq_cst _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_flag _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_bool _LIBCPP_USING_IF_EXISTS;
-using std::atomic_char _LIBCPP_USING_IF_EXISTS;
-using std::atomic_schar _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uchar _LIBCPP_USING_IF_EXISTS;
-using std::atomic_short _LIBCPP_USING_IF_EXISTS;
-using std::atomic_ushort _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint _LIBCPP_USING_IF_EXISTS;
-using std::atomic_long _LIBCPP_USING_IF_EXISTS;
-using std::atomic_ulong _LIBCPP_USING_IF_EXISTS;
-using std::atomic_llong _LIBCPP_USING_IF_EXISTS;
-using std::atomic_ullong _LIBCPP_USING_IF_EXISTS;
-using std::atomic_char8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_char16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_char32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_wchar_t _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_int8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int64_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint64_t _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_int_least8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_least8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int_least16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_least16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int_least32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_least32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int_least64_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_least64_t _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_int_fast8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_fast8_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int_fast16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_fast16_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int_fast32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_fast32_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_int_fast64_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uint_fast64_t _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_intptr_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uintptr_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_size_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_ptrdiff_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_intmax_t _LIBCPP_USING_IF_EXISTS;
-using std::atomic_uintmax_t _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_compare_exchange_strong _LIBCPP_USING_IF_EXISTS;
-using std::atomic_compare_exchange_strong_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_compare_exchange_weak _LIBCPP_USING_IF_EXISTS;
-using std::atomic_compare_exchange_weak_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_exchange _LIBCPP_USING_IF_EXISTS;
-using std::atomic_exchange_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_add _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_add_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_and _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_and_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_or _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_or_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_sub _LIBCPP_USING_IF_EXISTS;
-using std::atomic_fetch_sub_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_flag_clear _LIBCPP_USING_IF_EXISTS;
-using std::atomic_flag_clear_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_flag_test_and_set _LIBCPP_USING_IF_EXISTS;
-using std::atomic_flag_test_and_set_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_is_lock_free _LIBCPP_USING_IF_EXISTS;
-using std::atomic_load _LIBCPP_USING_IF_EXISTS;
-using std::atomic_load_explicit _LIBCPP_USING_IF_EXISTS;
-using std::atomic_store _LIBCPP_USING_IF_EXISTS;
-using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS;
-
-using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS;
-using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
-
-#elif defined(_LIBCPP_COMPILER_CLANG_BASED)
-
-// Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking
-// the header. We do this because Clang has historically shipped a <stdatomic.h>
-// header that would be available in all Standard modes, and we don't want to
-// break that use case.
-# if __has_include_next(<stdatomic.h>)
-# include_next <stdatomic.h>
-# endif
-
-#endif // _LIBCPP_STD_VER > 20
-
-#endif // _LIBCPP_STDATOMIC_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h b/contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h
deleted file mode 100644
index c596f2441c..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_STDBOOL_H
-#define _LIBCPP_STDBOOL_H
-
-
-/*
- stdbool.h synopsis
-
-Macros:
-
- __bool_true_false_are_defined
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifdef _LIBCPP_COMPILER_MSVC
-#include Y_MSVC_INCLUDE_NEXT(stdbool.h)
-#else
-#include_next <stdbool.h>
-#endif
-
-#ifdef __cplusplus
-#undef bool
-#undef true
-#undef false
-#undef __bool_true_false_are_defined
-#define __bool_true_false_are_defined 1
-#endif
-
-#endif // _LIBCPP_STDBOOL_H
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd b/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd
index adad6790dc..235ae7f0e2 100644
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd
+++ b/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd
@@ -61,3 +61,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
+
+ class path;
+
+_LIBCPP_END_NAMESPACE_FILESYSTEM
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/typeindex b/contrib/libs/cxxsupp/libcxxmsvc/include/typeindex
deleted file mode 100644
index b5dcd8496a..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/typeindex
+++ /dev/null
@@ -1,115 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_TYPEINDEX
-#define _LIBCPP_TYPEINDEX
-
-/*
-
- typeindex synopsis
-
-namespace std
-{
-
-class type_index
-{
-public:
- type_index(const type_info& rhs) noexcept;
-
- bool operator==(const type_index& rhs) const noexcept;
- bool operator!=(const type_index& rhs) const noexcept;
- bool operator< (const type_index& rhs) const noexcept;
- bool operator<=(const type_index& rhs) const noexcept;
- bool operator> (const type_index& rhs) const noexcept;
- bool operator>=(const type_index& rhs) const noexcept;
-
- size_t hash_code() const noexcept;
- const char* name() const noexcept;
-};
-
-template <>
-struct hash<type_index>
- : public unary_function<type_index, size_t>
-{
- size_t operator()(type_index index) const noexcept;
-};
-
-} // std
-
-*/
-
-#include <__config>
-#include <__functional/unary_function.h>
-#include <compare>
-#include <typeinfo>
-#include <version>
-
-// TODO: remove these headers
-#include <__functional/binary_function.h>
-#include <__functional/invoke.h>
-#include <__functional/operations.h>
-#include <__functional/reference_wrapper.h>
-#include <__functional/weak_result_type.h>
-#include <__memory/allocator_arg_t.h>
-#include <__memory/uses_allocator.h>
-#include <new>
-#include <utility>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-class _LIBCPP_TEMPLATE_VIS type_index
-{
- const type_info* __t_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
-
- _LIBCPP_INLINE_VISIBILITY
- bool operator==(const type_index& __y) const _NOEXCEPT
- {return *__t_ == *__y.__t_;}
- _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const type_index& __y) const _NOEXCEPT
- {return *__t_ != *__y.__t_;}
- _LIBCPP_INLINE_VISIBILITY
- bool operator< (const type_index& __y) const _NOEXCEPT
- {return __t_->before(*__y.__t_);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator<=(const type_index& __y) const _NOEXCEPT
- {return !__y.__t_->before(*__t_);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator> (const type_index& __y) const _NOEXCEPT
- {return __y.__t_->before(*__t_);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator>=(const type_index& __y) const _NOEXCEPT
- {return !__t_->before(*__y.__t_);}
-
- _LIBCPP_INLINE_VISIBILITY
- size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
- _LIBCPP_INLINE_VISIBILITY
- const char* name() const _NOEXCEPT {return __t_->name();}
-};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<type_index>
- : public unary_function<type_index, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(type_index __index) const _NOEXCEPT
- {return __index.hash_code();}
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_TYPEINDEX
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map b/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map
deleted file mode 100644
index c854548950..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map
+++ /dev/null
@@ -1,2619 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_UNORDERED_MAP
-#define _LIBCPP_UNORDERED_MAP
-
-/*
-
- unordered_map synopsis
-
-#include <initializer_list>
-
-namespace std
-{
-
-template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
- class Alloc = allocator<pair<const Key, T>>>
-class unordered_map
-{
-public:
- // types
- typedef Key key_type;
- typedef T mapped_type;
- typedef Hash hasher;
- typedef Pred key_equal;
- typedef Alloc allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
-
- typedef /unspecified/ iterator;
- typedef /unspecified/ const_iterator;
- typedef /unspecified/ local_iterator;
- typedef /unspecified/ const_local_iterator;
-
- typedef unspecified node_type; // C++17
- typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17
-
- unordered_map()
- noexcept(
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value &&
- is_nothrow_default_constructible<allocator_type>::value);
- explicit unordered_map(size_type n, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- template <class InputIterator>
- unordered_map(InputIterator f, InputIterator l,
- size_type n = 0, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- explicit unordered_map(const allocator_type&);
- unordered_map(const unordered_map&);
- unordered_map(const unordered_map&, const Allocator&);
- unordered_map(unordered_map&&)
- noexcept(
- is_nothrow_move_constructible<hasher>::value &&
- is_nothrow_move_constructible<key_equal>::value &&
- is_nothrow_move_constructible<allocator_type>::value);
- unordered_map(unordered_map&&, const Allocator&);
- unordered_map(initializer_list<value_type>, size_type n = 0,
- const hasher& hf = hasher(), const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- unordered_map(size_type n, const allocator_type& a)
- : unordered_map(n, hasher(), key_equal(), a) {} // C++14
- unordered_map(size_type n, const hasher& hf, const allocator_type& a)
- : unordered_map(n, hf, key_equal(), a) {} // C++14
- template <class InputIterator>
- unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
- : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14
- template <class InputIterator>
- unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
- const allocator_type& a)
- : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14
- unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
- : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14
- unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
- const allocator_type& a)
- : unordered_map(il, n, hf, key_equal(), a) {} // C++14
- ~unordered_map();
- unordered_map& operator=(const unordered_map&);
- unordered_map& operator=(unordered_map&&)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- unordered_map& operator=(initializer_list<value_type>);
-
- allocator_type get_allocator() const noexcept;
-
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- iterator begin() noexcept;
- iterator end() noexcept;
- const_iterator begin() const noexcept;
- const_iterator end() const noexcept;
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
-
- template <class... Args>
- pair<iterator, bool> emplace(Args&&... args);
- template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- pair<iterator, bool> insert(const value_type& obj);
- template <class P>
- pair<iterator, bool> insert(P&& obj);
- iterator insert(const_iterator hint, const value_type& obj);
- template <class P>
- iterator insert(const_iterator hint, P&& obj);
- template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
- void insert(initializer_list<value_type>);
-
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- insert_return_type insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
-
- template <class... Args>
- pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
- template <class... Args>
- pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
- template <class... Args>
- iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
- template <class... Args>
- iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
- template <class M>
- pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
- template <class M>
- pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
- template <class M>
- iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
- template <class M>
- iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
-
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
-
- template<class H2, class P2>
- void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17
- template<class H2, class P2>
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17
-
- void swap(unordered_map&)
- noexcept(
- (!allocator_type::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value) &&
- __is_nothrow_swappable<hasher>::value &&
- __is_nothrow_swappable<key_equal>::value);
-
- hasher hash_function() const;
- key_equal key_eq() const;
-
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
- template<typename K>
- iterator find(const K& x); // C++20
- template<typename K>
- const_iterator find(const K& x) const; // C++20
- size_type count(const key_type& k) const;
- template<typename K>
- size_type count(const K& k) const; // C++20
- bool contains(const key_type& k) const; // C++20
- template<typename K>
- bool contains(const K& k) const; // C++20
- pair<iterator, iterator> equal_range(const key_type& k);
- pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
- template<typename K>
- pair<iterator, iterator> equal_range(const K& k); // C++20
- template<typename K>
- pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
-
- mapped_type& operator[](const key_type& k);
- mapped_type& operator[](key_type&& k);
-
- mapped_type& at(const key_type& k);
- const mapped_type& at(const key_type& k) const;
-
- size_type bucket_count() const noexcept;
- size_type max_bucket_count() const noexcept;
-
- size_type bucket_size(size_type n) const;
- size_type bucket(const key_type& k) const;
-
- local_iterator begin(size_type n);
- local_iterator end(size_type n);
- const_local_iterator begin(size_type n) const;
- const_local_iterator end(size_type n) const;
- const_local_iterator cbegin(size_type n) const;
- const_local_iterator cend(size_type n) const;
-
- float load_factor() const noexcept;
- float max_load_factor() const noexcept;
- void max_load_factor(float z);
- void rehash(size_type n);
- void reserve(size_type n);
-};
-
-template<class InputIterator,
- class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>,
- class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
-unordered_map(InputIterator, InputIterator, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_map<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred,
- Allocator>; // C++17
-
-template<class Key, class T, class Hash = hash<Key>,
- class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
-unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_map<Key, T, Hash, Pred, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-unordered_map(InputIterator, InputIterator, typename see below::size_type, Allocator)
- -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
- hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-unordered_map(InputIterator, InputIterator, Allocator)
- -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
- hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17
-
-template<class InputIterator, class Hash, class Allocator>
-unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
- -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash,
- equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17
-
-template<class Key, class T, typename Allocator>
-unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator)
- -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17
-
-template<class Key, class T, typename Allocator>
-unordered_map(initializer_list<pair<const Key, T>>, Allocator)
- -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17
-
-template<class Key, class T, class Hash, class Allocator>
-unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash, Allocator)
- -> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>; // C++17
-
-template <class Key, class T, class Hash, class Pred, class Alloc>
- void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
- unordered_map<Key, T, Hash, Pred, Alloc>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class Key, class T, class Hash, class Pred, class Alloc>
- bool
- operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& x,
- const unordered_map<Key, T, Hash, Pred, Alloc>& y);
-
-template <class Key, class T, class Hash, class Pred, class Alloc>
- bool
- operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& x,
- const unordered_map<Key, T, Hash, Pred, Alloc>& y);
-
-template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
- class Alloc = allocator<pair<const Key, T>>>
-class unordered_multimap
-{
-public:
- // types
- typedef Key key_type;
- typedef T mapped_type;
- typedef Hash hasher;
- typedef Pred key_equal;
- typedef Alloc allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
-
- typedef /unspecified/ iterator;
- typedef /unspecified/ const_iterator;
- typedef /unspecified/ local_iterator;
- typedef /unspecified/ const_local_iterator;
-
- typedef unspecified node_type; // C++17
-
- unordered_multimap()
- noexcept(
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value &&
- is_nothrow_default_constructible<allocator_type>::value);
- explicit unordered_multimap(size_type n, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- template <class InputIterator>
- unordered_multimap(InputIterator f, InputIterator l,
- size_type n = 0, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- explicit unordered_multimap(const allocator_type&);
- unordered_multimap(const unordered_multimap&);
- unordered_multimap(const unordered_multimap&, const Allocator&);
- unordered_multimap(unordered_multimap&&)
- noexcept(
- is_nothrow_move_constructible<hasher>::value &&
- is_nothrow_move_constructible<key_equal>::value &&
- is_nothrow_move_constructible<allocator_type>::value);
- unordered_multimap(unordered_multimap&&, const Allocator&);
- unordered_multimap(initializer_list<value_type>, size_type n = 0,
- const hasher& hf = hasher(), const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- unordered_multimap(size_type n, const allocator_type& a)
- : unordered_multimap(n, hasher(), key_equal(), a) {} // C++14
- unordered_multimap(size_type n, const hasher& hf, const allocator_type& a)
- : unordered_multimap(n, hf, key_equal(), a) {} // C++14
- template <class InputIterator>
- unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
- : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14
- template <class InputIterator>
- unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
- const allocator_type& a)
- : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14
- unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
- : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14
- unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
- const allocator_type& a)
- : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14
- ~unordered_multimap();
- unordered_multimap& operator=(const unordered_multimap&);
- unordered_multimap& operator=(unordered_multimap&&)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- unordered_multimap& operator=(initializer_list<value_type>);
-
- allocator_type get_allocator() const noexcept;
-
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- iterator begin() noexcept;
- iterator end() noexcept;
- const_iterator begin() const noexcept;
- const_iterator end() const noexcept;
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
-
- template <class... Args>
- iterator emplace(Args&&... args);
- template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- iterator insert(const value_type& obj);
- template <class P>
- iterator insert(P&& obj);
- iterator insert(const_iterator hint, const value_type& obj);
- template <class P>
- iterator insert(const_iterator hint, P&& obj);
- template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
- void insert(initializer_list<value_type>);
-
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- iterator insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
-
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
-
- template<class H2, class P2>
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17
- template<class H2, class P2>
- void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17
-
- void swap(unordered_multimap&)
- noexcept(
- (!allocator_type::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value) &&
- __is_nothrow_swappable<hasher>::value &&
- __is_nothrow_swappable<key_equal>::value);
-
- hasher hash_function() const;
- key_equal key_eq() const;
-
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
- template<typename K>
- iterator find(const K& x); // C++20
- template<typename K>
- const_iterator find(const K& x) const; // C++20
- size_type count(const key_type& k) const;
- template<typename K>
- size_type count(const K& k) const; // C++20
- bool contains(const key_type& k) const; // C++20
- template<typename K>
- bool contains(const K& k) const; // C++20
- pair<iterator, iterator> equal_range(const key_type& k);
- pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
- template<typename K>
- pair<iterator, iterator> equal_range(const K& k); // C++20
- template<typename K>
- pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
-
- size_type bucket_count() const noexcept;
- size_type max_bucket_count() const noexcept;
-
- size_type bucket_size(size_type n) const;
- size_type bucket(const key_type& k) const;
-
- local_iterator begin(size_type n);
- local_iterator end(size_type n);
- const_local_iterator begin(size_type n) const;
- const_local_iterator end(size_type n) const;
- const_local_iterator cbegin(size_type n) const;
- const_local_iterator cend(size_type n) const;
-
- float load_factor() const noexcept;
- float max_load_factor() const noexcept;
- void max_load_factor(float z);
- void rehash(size_type n);
- void reserve(size_type n);
-};
-
-template<class InputIterator,
- class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>,
- class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
-unordered_multimap(InputIterator, InputIterator, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_multimap<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred,
- Allocator>; // C++17
-
-template<class Key, class T, class Hash = hash<Key>,
- class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
-unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_multimap<Key, T, Hash, Pred, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Allocator)
- -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
- hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-unordered_multimap(InputIterator, InputIterator, Allocator)
- -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
- hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17
-
-template<class InputIterator, class Hash, class Allocator>
-unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
- -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash,
- equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17
-
-template<class Key, class T, typename Allocator>
-unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator)
- -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17
-
-template<class Key, class T, typename Allocator>
-unordered_multimap(initializer_list<pair<const Key, T>>, Allocator)
- -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17
-
-template<class Key, class T, class Hash, class Allocator>
-unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash,
- Allocator)
- -> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>; // C++17
-
-template <class Key, class T, class Hash, class Pred, class Alloc>
- void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
- unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class K, class T, class H, class P, class A, class Predicate>
- typename unordered_map<K, T, H, P, A>::size_type
- erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred); // C++20
-
-template <class K, class T, class H, class P, class A, class Predicate>
- typename unordered_multimap<K, T, H, P, A>::size_type
- erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred); // C++20
-
-template <class Key, class T, class Hash, class Pred, class Alloc>
- bool
- operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
- const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
-
-template <class Key, class T, class Hash, class Pred, class Alloc>
- bool
- operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
- const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
-
-} // std
-
-*/
-
-#include <__algorithm/is_permutation.h>
-#include <__assert>
-#include <__config>
-#include <__debug>
-#include <__functional/is_transparent.h>
-#include <__hash_table>
-#include <__iterator/iterator_traits.h>
-#include <__memory/addressof.h>
-#include <__node_handle>
-#include <__utility/forward.h>
-#include <compare>
-#include <functional>
-#include <iterator> // __libcpp_erase_if_container
-#include <stdexcept>
-#include <tuple>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Key, class _Cp, class _Hash, class _Pred,
- bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
-class __unordered_map_hasher
- : private _Hash
-{
-public:
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_hasher()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
- : _Hash() {}
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_hasher(const _Hash& __h)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
- : _Hash(__h) {}
- _LIBCPP_INLINE_VISIBILITY
- const _Hash& hash_function() const _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _Cp& __x) const
- {return static_cast<const _Hash&>(*this)(__x.__get_value().first);}
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _Key& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
-#if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _K2& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- void swap(__unordered_map_hasher& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
- {
- using _VSTD::swap;
- swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
- }
-};
-
-template <class _Key, class _Cp, class _Hash, class _Pred>
-class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false>
-{
- _Hash __hash_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_hasher()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
- : __hash_() {}
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_hasher(const _Hash& __h)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
- : __hash_(__h) {}
- _LIBCPP_INLINE_VISIBILITY
- const _Hash& hash_function() const _NOEXCEPT {return __hash_;}
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _Cp& __x) const
- {return __hash_(__x.__get_value().first);}
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _Key& __x) const
- {return __hash_(__x);}
-#if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _K2& __x) const
- {return __hash_(__x);}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- void swap(__unordered_map_hasher& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
- {
- using _VSTD::swap;
- swap(__hash_, __y.__hash_);
- }
-};
-
-template <class _Key, class _Cp, class _Hash, class _Pred, bool __b>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x,
- __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-template <class _Key, class _Cp, class _Pred, class _Hash,
- bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
-class __unordered_map_equal
- : private _Pred
-{
-public:
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_equal()
- _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
- : _Pred() {}
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_equal(const _Pred& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
- : _Pred(__p) {}
- _LIBCPP_INLINE_VISIBILITY
- const _Pred& key_eq() const _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Cp& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Cp& __x, const _Key& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Key& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
-#if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Cp& __x, const _K2& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _K2& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Key& __x, const _K2& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _K2& __x, const _Key& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- void swap(__unordered_map_equal& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
- {
- using _VSTD::swap;
- swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
- }
-};
-
-template <class _Key, class _Cp, class _Pred, class _Hash>
-class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false>
-{
- _Pred __pred_;
-public:
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_equal()
- _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
- : __pred_() {}
- _LIBCPP_INLINE_VISIBILITY
- __unordered_map_equal(const _Pred& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
- : __pred_(__p) {}
- _LIBCPP_INLINE_VISIBILITY
- const _Pred& key_eq() const _NOEXCEPT {return __pred_;}
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Cp& __x, const _Cp& __y) const
- {return __pred_(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Cp& __x, const _Key& __y) const
- {return __pred_(__x.__get_value().first, __y);}
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Key& __x, const _Cp& __y) const
- {return __pred_(__x, __y.__get_value().first);}
-#if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Cp& __x, const _K2& __y) const
- {return __pred_(__x.__get_value().first, __y);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _K2& __x, const _Cp& __y) const
- {return __pred_(__x, __y.__get_value().first);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Key& __x, const _K2& __y) const
- {return __pred_(__x, __y);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- bool operator()(const _K2& __x, const _Key& __y) const
- {return __pred_(__x, __y);}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- void swap(__unordered_map_equal& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
- {
- using _VSTD::swap;
- swap(__pred_, __y.__pred_);
- }
-};
-
-template <class _Key, class _Cp, class _Pred, class _Hash, bool __b>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x,
- __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-template <class _Alloc>
-class __hash_map_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
-
-public:
-
- typedef typename __alloc_traits::pointer pointer;
-private:
-
- allocator_type& __na_;
-
- __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
-
-public:
- bool __first_constructed;
- bool __second_constructed;
-
- _LIBCPP_INLINE_VISIBILITY
- explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
- _NOEXCEPT
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
-#else // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- const_cast<bool&>(__x.__value_constructed) = false;
- }
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
-};
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class _Key, class _Tp>
-struct _LIBCPP_STANDALONE_DEBUG __hash_value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
- typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
-
-private:
- value_type __cc;
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- value_type& __get_value()
- {
-#if _LIBCPP_STD_VER > 14
- return *_VSTD::launder(_VSTD::addressof(__cc));
-#else
- return __cc;
-#endif
- }
-
- _LIBCPP_INLINE_VISIBILITY
- const value_type& __get_value() const
- {
-#if _LIBCPP_STD_VER > 14
- return *_VSTD::launder(_VSTD::addressof(__cc));
-#else
- return __cc;
-#endif
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __nc_ref_pair_type __ref()
- {
- value_type& __v = __get_value();
- return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __nc_rref_pair_type __move()
- {
- value_type& __v = __get_value();
- return __nc_rref_pair_type(
- _VSTD::move(const_cast<key_type&>(__v.first)),
- _VSTD::move(__v.second));
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_value_type& operator=(const __hash_value_type& __v)
- {
- __ref() = __v.__get_value();
- return *this;
- }
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_value_type& operator=(__hash_value_type&& __v)
- {
- __ref() = __v.__move();
- return *this;
- }
-
- template <class _ValueTp,
- class = typename enable_if<
- __is_same_uncvref<_ValueTp, value_type>::value
- >::type
- >
- _LIBCPP_INLINE_VISIBILITY
- __hash_value_type& operator=(_ValueTp&& __v)
- {
- __ref() = _VSTD::forward<_ValueTp>(__v);
- return *this;
- }
-
-private:
- __hash_value_type(const __hash_value_type& __v) = delete;
- __hash_value_type(__hash_value_type&& __v) = delete;
- template <class ..._Args>
- explicit __hash_value_type(_Args&& ...__args) = delete;
-
- ~__hash_value_type() = delete;
-};
-
-#else
-
-template <class _Key, class _Tp>
-struct __hash_value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
-
-private:
- value_type __cc;
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- value_type& __get_value() { return __cc; }
- _LIBCPP_INLINE_VISIBILITY
- const value_type& __get_value() const { return __cc; }
-
-private:
- ~__hash_value_type();
-};
-
-#endif
-
-template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
-{
- _HashIterator __i_;
-
- typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
-
-public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__map_value_type_pointer pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_iterator() _NOEXCEPT {}
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
-
- _LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_iterator operator++(int)
- {
- __hash_map_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
-};
-
-template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
-{
- _HashIterator __i_;
-
- typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
-
-public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_const_iterator() _NOEXCEPT {}
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_const_iterator(
- __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
- _NOEXCEPT
- : __i_(__i.__i_) {}
-
- _LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_INLINE_VISIBILITY
- __hash_map_const_iterator operator++(int)
- {
- __hash_map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
-};
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-class unordered_multimap;
-
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
- class _Alloc = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS unordered_map
-{
-public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __identity_t<_Hash> hasher;
- typedef __identity_t<_Pred> key_equal;
- typedef __identity_t<_Alloc> allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Invalid allocator::value_type");
-
-private:
- typedef __hash_value_type<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
- typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
- typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
- __value_type>::type __allocator_type;
-
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::_NodeTypes _NodeTypes;
- typedef typename __table::__node_pointer __node_pointer;
- typedef typename __table::__node_const_pointer __node_const_pointer;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
- typedef allocator_traits<allocator_type> __alloc_traits;
-
- static_assert((is_same<typename __table::__container_value_type, value_type>::value), "");
- static_assert((is_same<typename __table::__node_value_type, __value_type>::value), "");
-public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
- typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
- typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
-
-#if _LIBCPP_STD_VER > 14
- typedef __map_node_handle<__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
-#endif
-
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_map()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- _VSTD::__debug_db_insert_c(this);
- }
- explicit unordered_map(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- unordered_map(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- unordered_map(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- unordered_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- unordered_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_INLINE_VISIBILITY
- explicit unordered_map(const allocator_type& __a);
- unordered_map(const unordered_map& __u);
- unordered_map(const unordered_map& __u, const allocator_type& __a);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- unordered_map(unordered_map&& __u, const allocator_type& __a);
- unordered_map(initializer_list<value_type> __il);
- unordered_map(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
- unordered_map(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#endif // _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER > 11
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(size_type __n, const allocator_type& __a)
- : unordered_map(__n, hasher(), key_equal(), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_map(__n, __hf, key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
- : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
- const allocator_type& __a)
- : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
- : unordered_map(__il, __n, hasher(), key_equal(), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const allocator_type& __a)
- : unordered_map(__il, __n, __hf, key_equal(), __a) {}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- ~unordered_map() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
- }
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_map& operator=(const unordered_map& __u)
- {
-#ifndef _LIBCPP_CXX03_LANG
- __table_ = __u.__table_;
-#else
- if (this != _VSTD::addressof(__u)) {
- __table_.clear();
- __table_.hash_function() = __u.__table_.hash_function();
- __table_.key_eq() = __u.__table_.key_eq();
- __table_.max_load_factor() = __u.__table_.max_load_factor();
- __table_.__copy_assign_alloc(__u.__table_);
- insert(__u.begin(), __u.end());
- }
-#endif
- return *this;
- }
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_map& operator=(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_INLINE_VISIBILITY
- unordered_map& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
-
- iterator insert(const_iterator __p, const value_type& __x) {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_map::insert(const_iterator, const value_type&) called with an iterator not "
- "referring to this unordered_map");
- ((void)__p);
- return insert(__x).first;
- }
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __first, _InputIterator __last);
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(value_type&& __x)
- {return __table_.__insert_unique(_VSTD::move(__x));}
-
- iterator insert(const_iterator __p, value_type&& __x) {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
- " referring to this unordered_map");
- ((void)__p);
- return __table_.__insert_unique(_VSTD::move(__x)).first;
- }
-
- template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(_Pp&& __x)
- {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));}
-
- template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, _Pp&& __x)
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_map::insert(const_iterator, value_type&&) called with an iterator not"
- " referring to this unordered_map");
- ((void)__p);
- return insert(_VSTD::forward<_Pp>(__x)).first;
- }
-
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> emplace(_Args&&... __args) {
- return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);
- }
-
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p, _Args&&... __args) {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not"
- " referring to this unordered_map");
- ((void)__p);
- return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
- }
-
-#endif // _LIBCPP_CXX03_LANG
-
-#if _LIBCPP_STD_VER > 14
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
- {
- return __table_.__emplace_unique_key_args(__k, piecewise_construct,
- _VSTD::forward_as_tuple(__k),
- _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
- }
-
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
- {
- return __table_.__emplace_unique_key_args(__k, piecewise_construct,
- _VSTD::forward_as_tuple(_VSTD::move(__k)),
- _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
- }
-
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this,
- "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
- " referring to this unordered_map");
- ((void)__h);
- return try_emplace(__k, _VSTD::forward<_Args>(__args)...).first;
- }
-
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
- {
- _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this,
- "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
- " referring to this unordered_map");
- ((void)__h);
- return try_emplace(_VSTD::move(__k), _VSTD::forward<_Args>(__args)...).first;
- }
-
- template <class _Vp>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
- {
- pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k,
- __k, _VSTD::forward<_Vp>(__v));
- if (!__res.second) {
- __res.first->second = _VSTD::forward<_Vp>(__v);
- }
- return __res;
- }
-
- template <class _Vp>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
- {
- pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k,
- _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
- if (!__res.second) {
- __res.first->second = _VSTD::forward<_Vp>(__v);
- }
- return __res;
- }
-
- template <class _Vp>
- _LIBCPP_INLINE_VISIBILITY
- iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v)
- {
- // FIXME: Add debug mode checking for the iterator input
- return insert_or_assign(__k, _VSTD::forward<_Vp>(__v)).first;
- }
-
- template <class _Vp>
- _LIBCPP_INLINE_VISIBILITY
- iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v)
- {
- // FIXME: Add debug mode checking for the iterator input
- return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first;
- }
-#endif // _LIBCPP_STD_VER > 14
-
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_INLINE_VISIBILITY
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {__table_.clear();}
-
-#if _LIBCPP_STD_VER > 14
- _LIBCPP_INLINE_VISIBILITY
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_map::insert()");
- return __table_.template __node_handle_insert_unique<
- node_type, insert_return_type>(_VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_map::insert()");
- return __table_.template __node_handle_insert_unique<node_type>(
- __hint.__i_, _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(unordered_map& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- { __table_.swap(__u.__table_);}
-
- _LIBCPP_INLINE_VISIBILITY
- hasher hash_function() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_INLINE_VISIBILITY
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const _K2& __k) const {return __table_.__count_unique(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
-#if _LIBCPP_STD_VER > 17
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const key_type& __k) const {return find(__k) != end();}
-
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const _K2& __k) const {return find(__k) != end();}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_unique(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_unique(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- mapped_type& operator[](const key_type& __k);
-#ifndef _LIBCPP_CXX03_LANG
- mapped_type& operator[](key_type&& __k);
-#endif
-
- mapped_type& at(const key_type& __k);
- const mapped_type& at(const key_type& __k) const;
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_size(size_type __n) const
- {return __table_.bucket_size(__n);}
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_INLINE_VISIBILITY
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_INLINE_VISIBILITY
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_INLINE_VISIBILITY
- void rehash(size_type __n) {__table_.rehash(__n);}
- _LIBCPP_INLINE_VISIBILITY
- void reserve(size_type __n) {__table_.reserve(__n);}
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- bool __dereferenceable(const const_iterator* __i) const
- {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
- bool __decrementable(const const_iterator* __i) const
- {return __table_.__decrementable(_VSTD::addressof(__i->__i_));}
- bool __addable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
- bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
-private:
-
-#ifdef _LIBCPP_CXX03_LANG
- __node_holder __construct_node_with_key(const key_type& __k);
-#endif
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_key_type<_InputIterator>>,
- class _Pred = equal_to<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
- class _Pred = equal_to<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(_InputIterator, _InputIterator, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp, _Hash,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-#endif
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const allocator_type& __a)
- : __table_(typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__first, __last);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const unordered_map& __u)
- : __table_(__u.__table_)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const unordered_map& __u, const allocator_type& __a)
- : __table_(__u.__table_, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(_VSTD::move(__u.__table_))
-{
- _VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- unordered_map&& __u, const allocator_type& __a)
- : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0) {
- __table_.__emplace_unique(
- __u.__table_.remove((__i++).__i_)->__value_.__move());
- }
- }
-#if _LIBCPP_DEBUG_LEVEL == 2
- else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = _VSTD::move(__u.__table_);
- return *this;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_unique(__il.begin(), __il.end());
- return *this;
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-inline
-void
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- return __table_.__emplace_unique_key_args(__k,
- piecewise_construct, _VSTD::forward_as_tuple(__k),
- _VSTD::forward_as_tuple()).first->__get_value().second;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
-{
- return __table_.__emplace_unique_key_args(__k,
- piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)),
- _VSTD::forward_as_tuple()).first->__get_value().second;
-}
-#else // _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k)
-{
- __node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i != end())
- return __i->second;
- __node_holder __h = __construct_node_with_key(__k);
- pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
- __h.release();
- return __r.first->second;
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- __throw_out_of_range("unordered_map::at: key not found");
- return __i->second;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-const _Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
-{
- const_iterator __i = find(__k);
- if (__i == end())
- __throw_out_of_range("unordered_map::at: key not found");
- return __i->second;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
- return _VSTD::__libcpp_erase_if_container(__c, __pred);
-}
-#endif
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-bool
-operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(__i->first);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
- class _Alloc = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS unordered_multimap
-{
-public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __identity_t<_Hash> hasher;
- typedef __identity_t<_Pred> key_equal;
- typedef __identity_t<_Alloc> allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Invalid allocator::value_type");
-
-private:
- typedef __hash_value_type<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
- typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
- typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
- __value_type>::type __allocator_type;
-
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::_NodeTypes _NodeTypes;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
- typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert((is_same<typename __node_traits::size_type,
- typename __alloc_traits::size_type>::value),
- "Allocator uses different size_type for different types");
-public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
- typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
- typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
-
-#if _LIBCPP_STD_VER > 14
- typedef __map_node_handle<__node, allocator_type> node_type;
-#endif
-
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- _VSTD::__debug_db_insert_c(this);
- }
- explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- unordered_multimap(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- unordered_multimap(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- unordered_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- unordered_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_INLINE_VISIBILITY
- explicit unordered_multimap(const allocator_type& __a);
- unordered_multimap(const unordered_multimap& __u);
- unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
- unordered_multimap(initializer_list<value_type> __il);
- unordered_multimap(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- unordered_multimap(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#endif // _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER > 11
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(size_type __n, const allocator_type& __a)
- : unordered_multimap(__n, hasher(), key_equal(), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multimap(__n, __hf, key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
- : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
- const allocator_type& __a)
- : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
- : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const allocator_type& __a)
- : unordered_multimap(__il, __n, __hf, key_equal(), __a) {}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- ~unordered_multimap() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
- }
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap& operator=(const unordered_multimap& __u)
- {
-#ifndef _LIBCPP_CXX03_LANG
- __table_ = __u.__table_;
-#else
- if (this != _VSTD::addressof(__u)) {
- __table_.clear();
- __table_.hash_function() = __u.__table_.hash_function();
- __table_.key_eq() = __u.__table_.key_eq();
- __table_.max_load_factor() = __u.__table_.max_load_factor();
- __table_.__copy_assign_alloc(__u.__table_);
- insert(__u.begin(), __u.end());
- }
-#endif
- return *this;
- }
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap& operator=(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_INLINE_VISIBILITY
- unordered_multimap& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p.__i_, __x);}
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __first, _InputIterator __last);
-
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, value_type&& __x)
- {return __table_.__insert_multi(__p.__i_, _VSTD::move(__x));}
-
- template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(_Pp&& __x)
- {return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));}
-
- template <class _Pp,
- class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, _Pp&& __x)
- {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));}
-
- template <class... _Args>
- iterator emplace(_Args&&... __args) {
- return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);
- }
-
- template <class... _Args>
- iterator emplace_hint(const_iterator __p, _Args&&... __args) {
- return __table_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_Args>(__args)...);
- }
-#endif // _LIBCPP_CXX03_LANG
-
-
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_INLINE_VISIBILITY
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {__table_.clear();}
-
-#if _LIBCPP_STD_VER > 14
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multimap::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multimap::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- __hint.__i_, _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(unordered_multimap& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_INLINE_VISIBILITY
- hasher hash_function() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_INLINE_VISIBILITY
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const _K2& __k) const {return __table_.__count_multi(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
-#if _LIBCPP_STD_VER > 17
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const key_type& __k) const {return find(__k) != end();}
-
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const _K2& __k) const {return find(__k) != end();}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_multi(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_multi(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_bucket_count() const _NOEXCEPT
- {return __table_.max_bucket_count();}
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_size(size_type __n) const
- {return __table_.bucket_size(__n);}
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_INLINE_VISIBILITY
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_INLINE_VISIBILITY
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_INLINE_VISIBILITY
- void rehash(size_type __n) {__table_.rehash(__n);}
- _LIBCPP_INLINE_VISIBILITY
- void reserve(size_type __n) {__table_.reserve(__n);}
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- bool __dereferenceable(const const_iterator* __i) const
- {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
- bool __decrementable(const const_iterator* __i) const
- {return __table_.__decrementable(_VSTD::addressof(__i->__i_));}
- bool __addable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
- bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
-
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_key_type<_InputIterator>>,
- class _Pred = equal_to<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
- class _Pred = equal_to<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(_InputIterator, _InputIterator, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-#endif
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__first, __last);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const allocator_type& __a)
- : __table_(typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const unordered_multimap& __u)
- : __table_(__u.__table_)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const unordered_multimap& __u, const allocator_type& __a)
- : __table_(__u.__table_, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(_VSTD::move(__u.__table_))
-{
- _VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- unordered_multimap&& __u, const allocator_type& __a)
- : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- {
- __table_.__insert_multi(
- __u.__table_.remove((__i++).__i_)->__value_.__move());
- }
- }
-#if _LIBCPP_DEBUG_LEVEL == 2
- else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = _VSTD::move(__u.__table_);
- return *this;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_multi(__il.begin(), __il.end());
- return *this;
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-inline
-void
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
- return _VSTD::__libcpp_erase_if_container(__c, __pred);
-}
-#endif
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-bool
-operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(__i->first);
- _EqRng __yeq = __y.equal_range(__i->first);
- if (_VSTD::distance(__xeq.first, __xeq.second) !=
- _VSTD::distance(__yeq.first, __yeq.second) ||
- !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
-}
-
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_UNORDERED_MAP
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set b/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set
deleted file mode 100644
index 2f902cc793..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set
+++ /dev/null
@@ -1,1807 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_UNORDERED_SET
-#define _LIBCPP_UNORDERED_SET
-
-/*
-
- unordered_set synopsis
-
-#include <initializer_list>
-
-namespace std
-{
-
-template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
- class Alloc = allocator<Value>>
-class unordered_set
-{
-public:
- // types
- typedef Value key_type;
- typedef key_type value_type;
- typedef Hash hasher;
- typedef Pred key_equal;
- typedef Alloc allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
-
- typedef /unspecified/ iterator;
- typedef /unspecified/ const_iterator;
- typedef /unspecified/ local_iterator;
- typedef /unspecified/ const_local_iterator;
-
- typedef unspecified node_type unspecified; // C++17
- typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17
-
- unordered_set()
- noexcept(
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value &&
- is_nothrow_default_constructible<allocator_type>::value);
- explicit unordered_set(size_type n, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- template <class InputIterator>
- unordered_set(InputIterator f, InputIterator l,
- size_type n = 0, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- explicit unordered_set(const allocator_type&);
- unordered_set(const unordered_set&);
- unordered_set(const unordered_set&, const Allocator&);
- unordered_set(unordered_set&&)
- noexcept(
- is_nothrow_move_constructible<hasher>::value &&
- is_nothrow_move_constructible<key_equal>::value &&
- is_nothrow_move_constructible<allocator_type>::value);
- unordered_set(unordered_set&&, const Allocator&);
- unordered_set(initializer_list<value_type>, size_type n = 0,
- const hasher& hf = hasher(), const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- unordered_set(size_type n, const allocator_type& a); // C++14
- unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14
- template <class InputIterator>
- unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
- template <class InputIterator>
- unordered_set(InputIterator f, InputIterator l, size_type n,
- const hasher& hf, const allocator_type& a); // C++14
- unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
- unordered_set(initializer_list<value_type> il, size_type n,
- const hasher& hf, const allocator_type& a); // C++14
- ~unordered_set();
- unordered_set& operator=(const unordered_set&);
- unordered_set& operator=(unordered_set&&)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- unordered_set& operator=(initializer_list<value_type>);
-
- allocator_type get_allocator() const noexcept;
-
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- iterator begin() noexcept;
- iterator end() noexcept;
- const_iterator begin() const noexcept;
- const_iterator end() const noexcept;
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
-
- template <class... Args>
- pair<iterator, bool> emplace(Args&&... args);
- template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- pair<iterator, bool> insert(const value_type& obj);
- pair<iterator, bool> insert(value_type&& obj);
- iterator insert(const_iterator hint, const value_type& obj);
- iterator insert(const_iterator hint, value_type&& obj);
- template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
- void insert(initializer_list<value_type>);
-
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- insert_return_type insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
-
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
-
- template<class H2, class P2>
- void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17
- template<class H2, class P2>
- void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17
-
- void swap(unordered_set&)
- noexcept(allocator_traits<Allocator>::is_always_equal::value &&
- noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
- noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
-
- hasher hash_function() const;
- key_equal key_eq() const;
-
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
- template<typename K>
- iterator find(const K& x); // C++20
- template<typename K>
- const_iterator find(const K& x) const; // C++20
- size_type count(const key_type& k) const;
- template<typename K>
- size_type count(const K& k) const; // C++20
- bool contains(const key_type& k) const; // C++20
- template<typename K>
- bool contains(const K& k) const; // C++20
- pair<iterator, iterator> equal_range(const key_type& k);
- pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
- template<typename K>
- pair<iterator, iterator> equal_range(const K& k); // C++20
- template<typename K>
- pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
-
- size_type bucket_count() const noexcept;
- size_type max_bucket_count() const noexcept;
-
- size_type bucket_size(size_type n) const;
- size_type bucket(const key_type& k) const;
-
- local_iterator begin(size_type n);
- local_iterator end(size_type n);
- const_local_iterator begin(size_type n) const;
- const_local_iterator end(size_type n) const;
- const_local_iterator cbegin(size_type n) const;
- const_local_iterator cend(size_type n) const;
-
- float load_factor() const noexcept;
- float max_load_factor() const noexcept;
- void max_load_factor(float z);
- void rehash(size_type n);
- void reserve(size_type n);
-};
-
-template<class InputIterator,
- class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
- class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
- class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
-unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_set<typename iterator_traits<InputIterator>::value_type,
- Hash, Pred, Allocator>; // C++17
-
-template<class T, class Hash = hash<T>,
- class Pred = equal_to<T>, class Allocator = allocator<T>>
-unordered_set(initializer_list<T>, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_set<T, Hash, Pred, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-unordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator)
- -> unordered_set<typename iterator_traits<InputIterator>::value_type,
- hash<typename iterator_traits<InputIterator>::value_type>,
- equal_to<typename iterator_traits<InputIterator>::value_type>,
- Allocator>; // C++17
-
-template<class InputIterator, class Hash, class Allocator>
-unordered_set(InputIterator, InputIterator, typename see below::size_type,
- Hash, Allocator)
- -> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash,
- equal_to<typename iterator_traits<InputIterator>::value_type>,
- Allocator>; // C++17
-
-template<class T, class Allocator>
-unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
- -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; // C++17
-
-template<class T, class Hash, class Allocator>
-unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
- -> unordered_set<T, Hash, equal_to<T>, Allocator>; // C++17
-
-template <class Value, class Hash, class Pred, class Alloc>
- void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
- unordered_set<Value, Hash, Pred, Alloc>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class Value, class Hash, class Pred, class Alloc>
- bool
- operator==(const unordered_set<Value, Hash, Pred, Alloc>& x,
- const unordered_set<Value, Hash, Pred, Alloc>& y);
-
-template <class Value, class Hash, class Pred, class Alloc>
- bool
- operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x,
- const unordered_set<Value, Hash, Pred, Alloc>& y);
-
-template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
- class Alloc = allocator<Value>>
-class unordered_multiset
-{
-public:
- // types
- typedef Value key_type;
- typedef key_type value_type;
- typedef Hash hasher;
- typedef Pred key_equal;
- typedef Alloc allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
-
- typedef /unspecified/ iterator;
- typedef /unspecified/ const_iterator;
- typedef /unspecified/ local_iterator;
- typedef /unspecified/ const_local_iterator;
-
- typedef unspecified node_type unspecified; // C++17
-
- unordered_multiset()
- noexcept(
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value &&
- is_nothrow_default_constructible<allocator_type>::value);
- explicit unordered_multiset(size_type n, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- template <class InputIterator>
- unordered_multiset(InputIterator f, InputIterator l,
- size_type n = 0, const hasher& hf = hasher(),
- const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- explicit unordered_multiset(const allocator_type&);
- unordered_multiset(const unordered_multiset&);
- unordered_multiset(const unordered_multiset&, const Allocator&);
- unordered_multiset(unordered_multiset&&)
- noexcept(
- is_nothrow_move_constructible<hasher>::value &&
- is_nothrow_move_constructible<key_equal>::value &&
- is_nothrow_move_constructible<allocator_type>::value);
- unordered_multiset(unordered_multiset&&, const Allocator&);
- unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
- const hasher& hf = hasher(), const key_equal& eql = key_equal(),
- const allocator_type& a = allocator_type());
- unordered_multiset(size_type n, const allocator_type& a); // C++14
- unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14
- template <class InputIterator>
- unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
- template <class InputIterator>
- unordered_multiset(InputIterator f, InputIterator l, size_type n,
- const hasher& hf, const allocator_type& a); // C++14
- unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
- unordered_multiset(initializer_list<value_type> il, size_type n,
- const hasher& hf, const allocator_type& a); // C++14
- ~unordered_multiset();
- unordered_multiset& operator=(const unordered_multiset&);
- unordered_multiset& operator=(unordered_multiset&&)
- noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- unordered_multiset& operator=(initializer_list<value_type>);
-
- allocator_type get_allocator() const noexcept;
-
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
-
- iterator begin() noexcept;
- iterator end() noexcept;
- const_iterator begin() const noexcept;
- const_iterator end() const noexcept;
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
-
- template <class... Args>
- iterator emplace(Args&&... args);
- template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- iterator insert(const value_type& obj);
- iterator insert(value_type&& obj);
- iterator insert(const_iterator hint, const value_type& obj);
- iterator insert(const_iterator hint, value_type&& obj);
- template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
- void insert(initializer_list<value_type>);
-
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- iterator insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
-
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
-
- template<class H2, class P2>
- void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17
- template<class H2, class P2>
- void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17
- template<class H2, class P2>
- void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17
-
- void swap(unordered_multiset&)
- noexcept(allocator_traits<Allocator>::is_always_equal::value &&
- noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
- noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
-
- hasher hash_function() const;
- key_equal key_eq() const;
-
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
- template<typename K>
- iterator find(const K& x); // C++20
- template<typename K>
- const_iterator find(const K& x) const; // C++20
- size_type count(const key_type& k) const;
- template<typename K>
- size_type count(const K& k) const; // C++20
- bool contains(const key_type& k) const; // C++20
- template<typename K>
- bool contains(const K& k) const; // C++20
- pair<iterator, iterator> equal_range(const key_type& k);
- pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
- template<typename K>
- pair<iterator, iterator> equal_range(const K& k); // C++20
- template<typename K>
- pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
-
- size_type bucket_count() const noexcept;
- size_type max_bucket_count() const noexcept;
-
- size_type bucket_size(size_type n) const;
- size_type bucket(const key_type& k) const;
-
- local_iterator begin(size_type n);
- local_iterator end(size_type n);
- const_local_iterator begin(size_type n) const;
- const_local_iterator end(size_type n) const;
- const_local_iterator cbegin(size_type n) const;
- const_local_iterator cend(size_type n) const;
-
- float load_factor() const noexcept;
- float max_load_factor() const noexcept;
- void max_load_factor(float z);
- void rehash(size_type n);
- void reserve(size_type n);
-};
-
-template<class InputIterator,
- class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
- class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
- class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
-unordered_multiset(InputIterator, InputIterator, see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
- Hash, Pred, Allocator>; // C++17
-
-template<class T, class Hash = hash<T>,
- class Pred = equal_to<T>, class Allocator = allocator<T>>
-unordered_multiset(initializer_list<T>, typename see below::size_type = see below,
- Hash = Hash(), Pred = Pred(), Allocator = Allocator())
- -> unordered_multiset<T, Hash, Pred, Allocator>; // C++17
-
-template<class InputIterator, class Allocator>
-unordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator)
- -> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
- hash<typename iterator_traits<InputIterator>::value_type>,
- equal_to<typename iterator_traits<InputIterator>::value_type>,
- Allocator>; // C++17
-
-template<class InputIterator, class Hash, class Allocator>
-unordered_multiset(InputIterator, InputIterator, typename see below::size_type,
- Hash, Allocator)
- -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash,
- equal_to<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17
-
-template<class T, class Allocator>
-unordered_multiset(initializer_list<T>, typename see below::size_type, Allocator)
- -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>; // C++17
-
-template<class T, class Hash, class Allocator>
-unordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator)
- -> unordered_multiset<T, Hash, equal_to<T>, Allocator>; // C++17
-
-template <class Value, class Hash, class Pred, class Alloc>
- void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
- unordered_multiset<Value, Hash, Pred, Alloc>& y)
- noexcept(noexcept(x.swap(y)));
-
-template <class K, class T, class H, class P, class A, class Predicate>
- typename unordered_set<K, T, H, P, A>::size_type
- erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20
-
-template <class K, class T, class H, class P, class A, class Predicate>
- typename unordered_multiset<K, T, H, P, A>::size_type
- erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20
-
-
-template <class Value, class Hash, class Pred, class Alloc>
- bool
- operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
- const unordered_multiset<Value, Hash, Pred, Alloc>& y);
-
-template <class Value, class Hash, class Pred, class Alloc>
- bool
- operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
- const unordered_multiset<Value, Hash, Pred, Alloc>& y);
-} // std
-
-*/
-
-#include <__algorithm/is_permutation.h>
-#include <__assert>
-#include <__config>
-#include <__debug>
-#include <__functional/is_transparent.h>
-#include <__hash_table>
-#include <__memory/addressof.h>
-#include <__node_handle>
-#include <__utility/forward.h>
-#include <compare>
-#include <functional>
-#include <iterator> // __libcpp_erase_if_container
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-class unordered_multiset;
-
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
- class _Alloc = allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS unordered_set
-{
-public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef __identity_t<_Hash> hasher;
- typedef __identity_t<_Pred> key_equal;
- typedef __identity_t<_Alloc> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Invalid allocator::value_type");
-
-private:
- typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
-
- __table __table_;
-
-public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
- typedef typename __table::const_local_iterator local_iterator;
- typedef typename __table::const_local_iterator const_local_iterator;
-
-#if _LIBCPP_STD_VER > 14
- typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
-#endif
-
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_set;
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_set()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- _VSTD::__debug_db_insert_c(this);
- }
- explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
-#if _LIBCPP_STD_VER > 11
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_set(size_type __n, const allocator_type& __a)
- : unordered_set(__n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(__n, __hf, key_equal(), __a) {}
-#endif
- unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- unordered_set(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER > 11
- template <class _InputIterator>
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const allocator_type& __a)
- : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- explicit unordered_set(const allocator_type& __a);
- unordered_set(const unordered_set& __u);
- unordered_set(const unordered_set& __u, const allocator_type& __a);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_set(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- unordered_set(unordered_set&& __u, const allocator_type& __a);
- unordered_set(initializer_list<value_type> __il);
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER > 11
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const allocator_type& __a)
- : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const allocator_type& __a)
- : unordered_set(__il, __n, __hf, key_equal(), __a) {}
-#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- ~unordered_set() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
- }
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_set& operator=(const unordered_set& __u)
- {
- __table_ = __u.__table_;
- return *this;
- }
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_set& operator=(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_INLINE_VISIBILITY
- unordered_set& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> emplace(_Args&&... __args)
- {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not"
- " referring to this unordered_set");
- return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
- }
-#else
- iterator emplace_hint(const_iterator, _Args&&... __args)
- {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(value_type&& __x)
- {return __table_.__insert_unique(_VSTD::move(__x));}
- _LIBCPP_INLINE_VISIBILITY
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator insert(const_iterator __p, value_type&& __x)
- {
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
- " referring to this unordered_set");
- return insert(_VSTD::move(__x)).first;
- }
-#else
- iterator insert(const_iterator, value_type&& __x)
- {return insert(_VSTD::move(__x)).first;}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
-
- _LIBCPP_INLINE_VISIBILITY
-#if _LIBCPP_DEBUG_LEVEL == 2
- iterator insert(const_iterator __p, const value_type& __x)
- {
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
- "unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
- " referring to this unordered_set");
- return insert(__x).first;
- }
-#else
- iterator insert(const_iterator, const value_type& __x)
- {return insert(__x).first;}
-#endif
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __p) {return __table_.erase(__p);}
- _LIBCPP_INLINE_VISIBILITY
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first, __last);}
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {__table_.clear();}
-
-#if _LIBCPP_STD_VER > 14
- _LIBCPP_INLINE_VISIBILITY
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_set::insert()");
- return __table_.template __node_handle_insert_unique<
- node_type, insert_return_type>(_VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __h, node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_set::insert()");
- return __table_.template __node_handle_insert_unique<node_type>(
- __h, _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(__it);
- }
-
- template<class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(unordered_set& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_INLINE_VISIBILITY
- hasher hash_function() const {return __table_.hash_function();}
- _LIBCPP_INLINE_VISIBILITY
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const _K2& __k) const {return __table_.__count_unique(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
-#if _LIBCPP_STD_VER > 17
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const key_type& __k) const {return find(__k) != end();}
-
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const _K2& __k) const {return find(__k) != end();}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
-#if _LIBCPP_STD_VER > 17
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_unique(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_unique(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_INLINE_VISIBILITY
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_INLINE_VISIBILITY
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_INLINE_VISIBILITY
- void rehash(size_type __n) {__table_.rehash(__n);}
- _LIBCPP_INLINE_VISIBILITY
- void reserve(size_type __n) {__table_.reserve(__n);}
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- bool __dereferenceable(const const_iterator* __i) const
- {return __table_.__dereferenceable(__i);}
- bool __decrementable(const const_iterator* __i) const
- {return __table_.__decrementable(__i);}
- bool __addable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(__i, __n);}
- bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(__i, __n);}
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_value_type<_InputIterator>>,
- class _Pred = equal_to<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-template<class _Tp, class _Hash = hash<_Tp>,
- class _Pred = equal_to<_Tp>,
- class _Allocator = allocator<_Tp>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator,
- typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<__iter_value_type<_InputIterator>,
- hash<__iter_value_type<_InputIterator>>,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator,
- typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<__iter_value_type<_InputIterator>, _Hash,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
-
-template<class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
-#endif
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__first, __last);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const allocator_type& __a)
- : __table_(__a)
-{
- _VSTD::__debug_db_insert_c(this);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const unordered_set& __u)
- : __table_(__u.__table_)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const unordered_set& __u, const allocator_type& __a)
- : __table_(__u.__table_, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(_VSTD::move(__u.__table_))
-{
- _VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- unordered_set&& __u, const allocator_type& __a)
- : __table_(_VSTD::move(__u.__table_), __a)
-{
- _VSTD::__debug_db_insert_c(this);
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
- }
-#if _LIBCPP_DEBUG_LEVEL == 2
- else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>&
-unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = _VSTD::move(__u.__table_);
- return *this;
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>&
-unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_unique(__il.begin(), __il.end());
- return *this;
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-inline
-void
-unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Value, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
- return _VSTD::__libcpp_erase_if_container(__c, __pred);
-}
-#endif
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-bool
-operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(*__i);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
- class _Alloc = allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS unordered_multiset
-{
-public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef __identity_t<_Hash> hasher;
- typedef __identity_t<_Pred> key_equal;
- typedef __identity_t<_Alloc> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Invalid allocator::value_type");
-
-private:
- typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
-
- __table __table_;
-
-public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
- typedef typename __table::const_local_iterator local_iterator;
- typedef typename __table::const_local_iterator const_local_iterator;
-
-#if _LIBCPP_STD_VER > 14
- typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
-#endif
-
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_set;
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_multiset()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- _VSTD::__debug_db_insert_c(this);
- }
- explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- unordered_multiset(size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
-#if _LIBCPP_STD_VER > 11
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(size_type __n, const allocator_type& __a)
- : unordered_multiset(__n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__n, __hf, key_equal(), __a) {}
-#endif
- template <class _InputIterator>
- unordered_multiset(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n , const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
-#if _LIBCPP_STD_VER > 11
- template <class _InputIterator>
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const allocator_type& __a)
- : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- explicit unordered_multiset(const allocator_type& __a);
- unordered_multiset(const unordered_multiset& __u);
- unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
- unordered_multiset(initializer_list<value_type> __il);
- unordered_multiset(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- unordered_multiset(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER > 11
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
- : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_INLINE_VISIBILITY
- unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
-#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- ~unordered_multiset() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
- }
-
- _LIBCPP_INLINE_VISIBILITY
- unordered_multiset& operator=(const unordered_multiset& __u)
- {
- __table_ = __u.__table_;
- return *this;
- }
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- unordered_multiset& operator=(unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- unordered_multiset& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_INLINE_VISIBILITY
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace(_Args&&... __args)
- {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, value_type&& __x)
- {return __table_.__insert_multi(__p, _VSTD::move(__x));}
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p, __x);}
-
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __first, _InputIterator __last);
-
-#if _LIBCPP_STD_VER > 14
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multiset::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multiset::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- __hint, _VSTD::move(__nh));
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(const_iterator __position)
- {
- return __table_.template __node_handle_extract<node_type>(
- __position);
- }
- _LIBCPP_INLINE_VISIBILITY
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_INLINE_VISIBILITY
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __p) {return __table_.erase(__p);}
- _LIBCPP_INLINE_VISIBILITY
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_INLINE_VISIBILITY
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first, __last);}
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT {__table_.clear();}
-
- _LIBCPP_INLINE_VISIBILITY
- void swap(unordered_multiset& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_INLINE_VISIBILITY
- hasher hash_function() const {return __table_.hash_function();}
- _LIBCPP_INLINE_VISIBILITY
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
-#if _LIBCPP_STD_VER > 17
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
-#if _LIBCPP_STD_VER > 17
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- size_type count(const _K2& __k) const {return __table_.__count_multi(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
-#if _LIBCPP_STD_VER > 17
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const key_type& __k) const {return find(__k) != end();}
-
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- bool contains(const _K2& __k) const {return find(__k) != end();}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
-#if _LIBCPP_STD_VER > 17
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_multi(__k);}
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_INLINE_VISIBILITY
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_multi(__k);}
-#endif // _LIBCPP_STD_VER > 17
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_INLINE_VISIBILITY
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
- _LIBCPP_INLINE_VISIBILITY
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_INLINE_VISIBILITY
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_INLINE_VISIBILITY
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_INLINE_VISIBILITY
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_INLINE_VISIBILITY
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_INLINE_VISIBILITY
- void rehash(size_type __n) {__table_.rehash(__n);}
- _LIBCPP_INLINE_VISIBILITY
- void reserve(size_type __n) {__table_.reserve(__n);}
-
-#if _LIBCPP_DEBUG_LEVEL == 2
-
- bool __dereferenceable(const const_iterator* __i) const
- {return __table_.__dereferenceable(__i);}
- bool __decrementable(const const_iterator* __i) const
- {return __table_.__decrementable(__i);}
- bool __addable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(__i, __n);}
- bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
- {return __table_.__addable(__i, __n);}
-
-#endif // _LIBCPP_DEBUG_LEVEL == 2
-
-};
-
-#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_value_type<_InputIterator>>,
- class _Pred = equal_to<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-template<class _Tp, class _Hash = hash<_Tp>,
- class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<__iter_value_type<_InputIterator>,
- hash<__iter_value_type<_InputIterator>>,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
- _Hash, _Allocator)
- -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
-
-template<class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
-#endif
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__first, __last);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__first, __last);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const allocator_type& __a)
- : __table_(__a)
-{
- _VSTD::__debug_db_insert_c(this);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const unordered_multiset& __u)
- : __table_(__u.__table_)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const unordered_multiset& __u, const allocator_type& __a)
- : __table_(__u.__table_, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__u.bucket_count());
- insert(__u.begin(), __u.end());
-}
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(_VSTD::move(__u.__table_))
-{
- _VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- unordered_multiset&& __u, const allocator_type& __a)
- : __table_(_VSTD::move(__u.__table_), __a)
-{
- _VSTD::__debug_db_insert_c(this);
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
- }
-#if _LIBCPP_DEBUG_LEVEL == 2
- else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il)
-{
- _VSTD::__debug_db_insert_c(this);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- _VSTD::__debug_db_insert_c(this);
- __table_.rehash(__n);
- insert(__il.begin(), __il.end());
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
- unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = _VSTD::move(__u.__table_);
- return *this;
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_multi(__il.begin(), __il.end());
- return *this;
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-template <class _InputIterator>
-inline
-void
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
-}
-
-#if _LIBCPP_STD_VER > 17
-template <class _Value, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
- typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
- return _VSTD::__libcpp_erase_if_container(__c, __pred);
-}
-#endif
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-bool
-operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(*__i);
- _EqRng __yeq = __y.equal_range(*__i);
- if (_VSTD::distance(__xeq.first, __xeq.second) !=
- _VSTD::distance(__yeq.first, __yeq.second) ||
- !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
-}
-
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_UNORDERED_SET
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h b/contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h
deleted file mode 100644
index c608202230..0000000000
--- a/contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-#if defined(__IOS__)
-#include_next <unwind.h>
-#else
-#include <contrib/libs/cxxsupp/libcxxrt/unwind.h>
-#endif