Import Cobalt 24.master.0.1033952
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/clamp.h b/third_party/llvm-project/libcxx/include/__algorithm/clamp.h
index 30ddbdc..336b93f 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/clamp.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/clamp.h
@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
template<class _Tp, class _Compare>
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY constexpr
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/comp.h b/third_party/llvm-project/libcxx/include/__algorithm/comp.h
index af8eb7b..1001e42 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/comp.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/comp.h
@@ -10,6 +10,8 @@
#define _LIBCPP___ALGORITHM_COMP_H
#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/predicate_traits.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -24,6 +26,9 @@
}
};
+template <class _Lhs, class _Rhs>
+struct __is_trivial_equality_predicate<__equal_to, _Lhs, _Rhs> : true_type {};
+
template <class _T1, class _T2 = _T1>
struct __less
{
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h b/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h
index b08bbdf..7089ef3 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h
@@ -12,8 +12,8 @@
#include <__algorithm/copy.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/enable_if.h>
#include <__utility/convert_to_integral.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/equal.h b/third_party/llvm-project/libcxx/include/__algorithm/equal.h
index cf37f46..a26299a 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/equal.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/equal.h
@@ -11,9 +11,20 @@
#define _LIBCPP___ALGORITHM_EQUAL_H
#include <__algorithm/comp.h>
+#include <__algorithm/unwrap_iter.h>
#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
+#include <__string/constexpr_c_functions.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_constant_evaluated.h>
+#include <__type_traits/is_equality_comparable.h>
+#include <__type_traits/is_volatile.h>
+#include <__type_traits/predicate_traits.h>
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -22,23 +33,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate& __pred) {
for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
return false;
return true;
}
+template <
+ class _Tp,
+ class _Up,
+ class _BinaryPredicate,
+ __enable_if_t<__is_trivial_equality_predicate<_BinaryPredicate, _Tp, _Up>::value && !is_volatile<_Tp>::value &&
+ !is_volatile<_Up>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
+ int> = 0>
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+__equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&) {
+ return std::__constexpr_memcmp(__first1, __first2, (__last1 - __first1) * sizeof(_Tp)) == 0;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
+ return std::__equal_iter_impl(
+ std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2), __pred);
+}
+
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
return std::equal(__first1, __last1, __first2, __equal_to());
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER >= 14
template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
__equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
_BinaryPredicate __pred, input_iterator_tag, input_iterator_tag) {
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
@@ -47,19 +77,52 @@
return __first1 == __last1 && __first2 == __last2;
}
+template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl(
+ _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __comp, _Proj1& __proj1, _Proj2& __proj2) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
+ return false;
+ ++__first1;
+ ++__first2;
+ }
+ return __first1 == __last1 && __first2 == __last2;
+}
+
+template <class _Tp,
+ class _Up,
+ class _Pred,
+ class _Proj1,
+ class _Proj2,
+ __enable_if_t<__is_trivial_equality_predicate<_Pred, _Tp, _Up>::value && __is_identity<_Proj1>::value &&
+ __is_identity<_Proj2>::value && !is_volatile<_Tp>::value && !is_volatile<_Up>::value &&
+ __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
+ int> = 0>
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl(
+ _Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&, _Proj2&) {
+ return std::__constexpr_memcmp(__first1, __first2, (__last1 - __first1) * sizeof(_Tp)) == 0;
+}
+
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
_RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag,
random_access_iterator_tag) {
if (_VSTD::distance(__first1, __last1) != _VSTD::distance(__first2, __last2))
return false;
- return _VSTD::equal<_RandomAccessIterator1, _RandomAccessIterator2,
- _BinaryPredicate&>(__first1, __last1, __first2, __pred);
+ __identity __proj;
+ return std::__equal_impl(
+ std::__unwrap_iter(__first1),
+ std::__unwrap_iter(__last1),
+ std::__unwrap_iter(__first2),
+ std::__unwrap_iter(__last2),
+ __pred,
+ __proj,
+ __proj);
}
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
_BinaryPredicate __pred) {
return _VSTD::__equal<_BinaryPredicate&>(
@@ -68,7 +131,7 @@
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
return std::__equal(
__first1,
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/fill.h b/third_party/llvm-project/libcxx/include/__algorithm/fill.h
index 76cf4a1..0753c42 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/fill.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/fill.h
@@ -12,7 +12,6 @@
#include <__algorithm/fill_n.h>
#include <__config>
#include <__iterator/iterator_traits.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h b/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h
index fe58c8d..e7863ac 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/convert_to_integral.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/find_end.h b/third_party/llvm-project/libcxx/include/__algorithm/find_end.h
index e2fee6b..edb9891 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/find_end.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/find_end.h
@@ -15,12 +15,12 @@
#include <__algorithm/search.h>
#include <__config>
#include <__functional/identity.h>
+#include <__functional/invoke.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
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h b/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h
index 38d204a..5bd7318 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__utility/convert_to_integral.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -20,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _Size, class _Function>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator for_each_n(_InputIterator __first,
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h b/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h
index 4525998..ff5c82d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h
@@ -11,7 +11,6 @@
#include <__config>
#include <__utility/convert_to_integral.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h b/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h
index 74aede2..5a0f4ba 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h
@@ -10,7 +10,9 @@
#define _LIBCPP___ALGORITHM_HALF_POSITIVE_H
#include <__config>
-#include <type_traits>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_integral.h>
+#include <__type_traits/make_unsigned.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h
index 3134d6e..d9ca287 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h
@@ -18,7 +18,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -44,6 +44,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_IN_FOUND_RESULT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h
index 3cbb9e1..33374ed 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
template <class _InIter1, class _Func1>
@@ -42,7 +42,7 @@
};
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
index 3e747be..6b50e0e 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
@@ -49,7 +49,7 @@
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h
index 2098c18..1eceb9d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
@@ -46,7 +46,7 @@
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
index 4046eee..2f7a09b 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
template <class _InIter1, class _OutIter1, class _OutIter2>
@@ -47,7 +47,7 @@
};
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h
index 7f5a027..158b355 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
@@ -46,7 +46,7 @@
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h
index 0054456..2a7c606 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h
@@ -19,8 +19,8 @@
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/next.h>
+#include <__type_traits/is_callable.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -31,7 +31,7 @@
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class = void>
struct _ConstTimeDistance : false_type {};
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2>
struct _ConstTimeDistance<_Iter1, _Sent1, _Iter2, _Sent2, __enable_if_t<
@@ -47,7 +47,7 @@
is_same<typename iterator_traits<_Iter2>::iterator_category, random_access_iterator_tag>::value
> > : true_type {};
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
// Internal functions
@@ -202,7 +202,7 @@
return std::is_permutation(__first1, __last1, __first2, __equal_to());
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER >= 14
// 2+2 iterators
template <class _ForwardIterator1, class _ForwardIterator2>
@@ -231,7 +231,7 @@
__pred, __identity(), __identity());
}
-#endif // _LIBCPP_STD_VER > 11
+#endif // _LIBCPP_STD_VER >= 14
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h b/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h
index bd3e6f1..2bdc0ac 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h
@@ -37,7 +37,7 @@
template <class _AlgPolicy> struct _IterOps;
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
struct _RangeAlgPolicy {};
template <>
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/lexicographical_compare_three_way.h b/third_party/llvm-project/libcxx/include/__algorithm/lexicographical_compare_three_way.h
new file mode 100644
index 0000000..377c8d2
--- /dev/null
+++ b/third_party/llvm-project/libcxx/include/__algorithm/lexicographical_compare_three_way.h
@@ -0,0 +1,125 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
+#define _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
+
+#include <__algorithm/min.h>
+#include <__algorithm/three_way_comp_ref_type.h>
+#include <__compare/compare_three_way.h>
+#include <__compare/ordering.h>
+#include <__concepts/arithmetic.h>
+#include <__config>
+#include <__iterator/iterator_traits.h>
+#include <__type_traits/common_type.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__utility/move.h>
+
+#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 >= 20
+
+// Fast path for random access iterators which computes the number of loop iterations up-front and
+// then skips the iterator comparisons inside the loop.
+template <class _InputIterator1, class _InputIterator2, class _Cmp>
+_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_path(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
+ -> decltype(__comp(*__first1, *__first2)) {
+ static_assert(
+ signed_integral<__iter_diff_t<_InputIterator1>>, "Using a non-integral difference_type is undefined behavior.");
+ static_assert(
+ signed_integral<__iter_diff_t<_InputIterator2>>, "Using a non-integral difference_type is undefined behavior.");
+
+ using _Len1 = __iter_diff_t<_InputIterator1>;
+ using _Len2 = __iter_diff_t<_InputIterator2>;
+ using _Common = common_type_t<_Len1, _Len2>;
+
+ _Len1 __len1 = __last1 - __first1;
+ _Len2 __len2 = __last2 - __first2;
+ _Common __min_len = std::min<_Common>(__len1, __len2);
+
+ for (_Common __i = 0; __i < __min_len; ++__i) {
+ auto __c = __comp(*__first1, *__first2);
+ if (__c != 0) {
+ return __c;
+ }
+ ++__first1;
+ ++__first2;
+ }
+
+ return __len1 <=> __len2;
+}
+
+// Unoptimized implementation which compares the iterators against the end in every loop iteration
+template <class _InputIterator1, class _InputIterator2, class _Cmp>
+_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_slow_path(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
+ -> decltype(__comp(*__first1, *__first2)) {
+ while (true) {
+ bool __exhausted1 = __first1 == __last1;
+ bool __exhausted2 = __first2 == __last2;
+
+ if (__exhausted1 || __exhausted2) {
+ if (!__exhausted1)
+ return strong_ordering::greater;
+ if (!__exhausted2)
+ return strong_ordering::less;
+ return strong_ordering::equal;
+ }
+
+ auto __c = __comp(*__first1, *__first2);
+ if (__c != 0) {
+ return __c;
+ }
+
+ ++__first1;
+ ++__first2;
+ }
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Cmp>
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto lexicographical_compare_three_way(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp __comp)
+ -> decltype(__comp(*__first1, *__first2)) {
+ static_assert(__comparison_category<decltype(__comp(*__first1, *__first2))>,
+ "The comparator passed to lexicographical_compare_three_way must return a comparison category type.");
+ static_assert(std::is_copy_constructible_v<_InputIterator1>, "Iterators must be copy constructible.");
+ static_assert(std::is_copy_constructible_v<_InputIterator2>, "Iterators must be copy constructible.");
+ __three_way_comp_ref_type<_Cmp> __wrapped_comp_ref(__comp);
+ if constexpr (__is_cpp17_random_access_iterator<_InputIterator1>::value &&
+ __is_cpp17_random_access_iterator<_InputIterator2>::value) {
+ return std::__lexicographical_compare_three_way_fast_path(
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __wrapped_comp_ref);
+ } else {
+ // Unoptimized implementation which compares the iterators against the end in every loop iteration
+ return std::__lexicographical_compare_three_way_slow_path(
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __wrapped_comp_ref);
+ }
+}
+
+template <class _InputIterator1, class _InputIterator2>
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto lexicographical_compare_three_way(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
+ return std::lexicographical_compare_three_way(
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::compare_three_way());
+}
+
+#endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h b/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h
index 2648982..8109393 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h
@@ -20,7 +20,6 @@
#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)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h b/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h
index 87d4d59..defda46 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h
@@ -55,25 +55,12 @@
};
-template <class _Pred, class _Proj, class = void>
-struct __can_use_pristine_comp : false_type {};
-
-template <class _Pred, class _Proj>
-struct __can_use_pristine_comp<_Pred, _Proj, __enable_if_t<
- !is_member_pointer<typename decay<_Pred>::type>::value && (
-#if _LIBCPP_STD_VER > 17
- is_same<typename decay<_Proj>::type, identity>::value ||
-#endif
- is_same<typename decay<_Proj>::type, __identity>::value
- )
-> > : true_type {};
-
-template <class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static
-__enable_if_t<
- !__can_use_pristine_comp<_Pred, _Proj>::value,
- _ProjectedPred<_Pred, _Proj>
->
+template <class _Pred,
+ class _Proj,
+ __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value &&
+ __is_identity<__decay_t<_Proj> >::value),
+ int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj>
__make_projected(_Pred& __pred, _Proj& __proj) {
return _ProjectedPred<_Pred, _Proj>(__pred, __proj);
}
@@ -81,28 +68,27 @@
// Avoid creating the functor and just use the pristine comparator -- for certain algorithms, this would enable
// optimizations that rely on the type of the comparator. Additionally, this results in less layers of indirection in
// the call stack when the comparator is invoked, even in an unoptimized build.
-template <class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static
-__enable_if_t<
- __can_use_pristine_comp<_Pred, _Proj>::value,
- _Pred&
->
-__make_projected(_Pred& __pred, _Proj&) {
+template <class _Pred,
+ class _Proj,
+ __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value &&
+ __is_identity<__decay_t<_Proj> >::value,
+ int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _Proj&) {
return __pred;
}
_LIBCPP_END_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Comp, class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI constexpr static
+_LIBCPP_HIDE_FROM_ABI constexpr
decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
- if constexpr (same_as<decay_t<_Proj1>, identity> && same_as<decay_t<_Proj2>, identity> &&
+ if constexpr (__is_identity<decay_t<_Proj1>>::value && __is_identity<decay_t<_Proj2>>::value &&
!is_member_pointer_v<decay_t<_Comp>>) {
// Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable
// optimizations that rely on the type of the comparator.
@@ -121,6 +107,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/max.h b/third_party/llvm-project/libcxx/include/__algorithm/max.h
index a08a3fc..97f61f2 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/max.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/max.h
@@ -28,7 +28,7 @@
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
const _Tp&
-max(const _Tp& __a, const _Tp& __b, _Compare __comp)
+max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
{
return __comp(__a, __b) ? __b : __a;
}
@@ -37,7 +37,7 @@
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
const _Tp&
-max(const _Tp& __a, const _Tp& __b)
+max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
{
return _VSTD::max(__a, __b, __less<_Tp>());
}
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/min.h b/third_party/llvm-project/libcxx/include/__algorithm/min.h
index 2882485..d073a16 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/min.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/min.h
@@ -28,7 +28,7 @@
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
const _Tp&
-min(const _Tp& __a, const _Tp& __b, _Compare __comp)
+min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
{
return __comp(__b, __a) ? __b : __a;
}
@@ -37,7 +37,7 @@
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
const _Tp&
-min(const _Tp& __a, const _Tp& __b)
+min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
{
return _VSTD::min(__a, __b, __less<_Tp>());
}
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h b/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h
index 4be3999..ef2d990 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h
@@ -23,7 +23,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
@@ -47,7 +47,7 @@
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/minmax.h b/third_party/llvm-project/libcxx/include/__algorithm/minmax.h
index 6ef0a77..f486de2 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/minmax.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/minmax.h
@@ -27,7 +27,7 @@
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
pair<const _Tp&, const _Tp&>
-minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
+minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
{
return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) :
pair<const _Tp&, const _Tp&>(__a, __b);
@@ -37,7 +37,7 @@
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
pair<const _Tp&, const _Tp&>
-minmax(const _Tp& __a, const _Tp& __b)
+minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
{
return std::minmax(__a, __b, __less<_Tp>());
}
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h b/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h
index caa963e..1ac4078 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h
@@ -12,9 +12,10 @@
#include <__algorithm/comp.h>
#include <__config>
#include <__functional/identity.h>
+#include <__functional/invoke.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
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h b/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h
index 600e2cd..e5b014f 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h
@@ -38,7 +38,7 @@
return std::mismatch(__first1, __last1, __first2, __equal_to());
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER >= 14
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h
index e0812af..4b8e0e7 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h
@@ -19,8 +19,9 @@
#include <__debug>
#include <__debug_utils/randomize_range.h>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_copy_assignable.h>
+#include <__type_traits/is_copy_constructible.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/partition.h b/third_party/llvm-project/libcxx/include/__algorithm/partition.h
index 0e094bf8..a58dd64 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/partition.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/partition.h
@@ -14,7 +14,6 @@
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h
index 94d32a4..4187523 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h
@@ -17,8 +17,9 @@
#include <__assert>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_copy_assignable.h>
+#include <__type_traits/is_copy_constructible.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h
index 9068495..e831162 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h
@@ -14,8 +14,9 @@
#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_copy_assignable.h>
+#include <__type_traits/is_copy_constructible.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h
index d338d13..e3de36b 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -73,6 +73,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h
index e45c4e5..494a77d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h
@@ -22,7 +22,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -63,6 +63,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h
index e7d1e72..eb102bd 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h
@@ -22,7 +22,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -63,6 +63,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h
index b2a8977..d89597e 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -36,7 +36,7 @@
_LIBCPP_NODISCARD_EXT _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<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
- return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first));
+ return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
}
template <forward_range _Range, class _Type, class _Proj = identity,
@@ -46,7 +46,7 @@
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
- return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first));
+ return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
}
};
} // namespace __binary_search
@@ -58,6 +58,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
index 09a97fc..45a8464 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
@@ -22,7 +22,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -60,6 +60,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_CLAMP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h
index bb02c84..f5700c3 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -62,6 +62,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h
index f41af66..b7b5b88 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -60,6 +60,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_COPY_BACKWARD_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h
index dba41c3..b714e4c 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -76,6 +76,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_COPY_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h
index 04bb80b..30ee019 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h
@@ -27,7 +27,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
@@ -70,7 +70,7 @@
} // namespace __cpo
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h
index 527dd06..677ee38 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -57,6 +57,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_COUNT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h
index 931618b..48c4370 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -67,6 +67,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_COUNT_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h
index 3c417f0..8754453 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h
@@ -9,6 +9,8 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_EQUAL_H
#define _LIBCPP___ALGORITHM_RANGES_EQUAL_H
+#include <__algorithm/equal.h>
+#include <__algorithm/unwrap_range.h>
#include <__config>
#include <__functional/identity.h>
#include <__functional/invoke.h>
@@ -24,36 +26,13 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __equal {
struct __fn {
-private:
- template <class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __equal_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (!std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2)))
- return false;
- ++__first1;
- ++__first2;
- }
- return __first1 == __last1 && __first2 == __last2;
- }
-
-public:
-
template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
input_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
class _Pred = ranges::equal_to,
@@ -70,11 +49,13 @@
if (__last1 - __first1 != __last2 - __first2)
return false;
}
- return __equal_impl(std::move(__first1), std::move(__last1),
- std::move(__first2), std::move(__last2),
- __pred,
- __proj1,
- __proj2);
+ auto __unwrapped1 = std::__unwrap_range(std::move(__first1), std::move(__last1));
+ auto __unwrapped2 = std::__unwrap_range(std::move(__first2), std::move(__last2));
+ return std::__equal_impl(std::move(__unwrapped1.first), std::move(__unwrapped1.second),
+ std::move(__unwrapped2.first), std::move(__unwrapped2.second),
+ __pred,
+ __proj1,
+ __proj2);
}
template <input_range _Range1,
@@ -93,11 +74,13 @@
if (ranges::distance(__range1) != ranges::distance(__range2))
return false;
}
- return __equal_impl(ranges::begin(__range1), ranges::end(__range1),
- ranges::begin(__range2), ranges::end(__range2),
- __pred,
- __proj1,
- __proj2);
+ auto __unwrapped1 = std::__unwrap_range(ranges::begin(__range1), ranges::end(__range1));
+ auto __unwrapped2 = std::__unwrap_range(ranges::begin(__range2), ranges::end(__range2));
+ return std::__equal_impl(std::move(__unwrapped1.first), std::move(__unwrapped1.second),
+ std::move(__unwrapped2.first), std::move(__unwrapped2.second),
+ __pred,
+ __proj1,
+ __proj2);
return false;
}
};
@@ -110,6 +93,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h
index 94dc058..075634a 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h
@@ -30,7 +30,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -73,6 +73,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_RANGE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h
index 6ebc2bd..4e0594c 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h
@@ -20,7 +20,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -54,6 +54,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FILL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h
index a2660e8..c5f7e6e 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h
@@ -17,7 +17,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -43,6 +43,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h
index 580c2a1..87f25d1 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h
@@ -26,7 +26,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -58,6 +58,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h
index ea36f4d..2d46e8c 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h
@@ -27,7 +27,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -93,6 +93,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h
index 9d66e75..5699583 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -96,6 +96,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h
index 45ce6e4..6e2bd4c 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h
@@ -24,14 +24,14 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Ip, class _Sp, class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI static constexpr
+_LIBCPP_HIDE_FROM_ABI constexpr
_Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
@@ -66,6 +66,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h
index 3dd1213..e60ee2b 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h
@@ -26,7 +26,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -58,6 +58,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h
index 0c70c05..a72f779 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -73,6 +73,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h
index 261816a..daf0a5d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -61,6 +61,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h
index ae486ae..de0db16 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -68,6 +68,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h
index e625e3a..122cd8d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -57,6 +57,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h
index 8438117..314a923 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h
@@ -27,7 +27,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -90,6 +90,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_INCLUDES_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h
index 88171a6..8f78975 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h
@@ -31,7 +31,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -80,6 +80,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_INPLACE_MERGE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h
index a16c075..9c77e0c 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h
@@ -26,7 +26,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -69,6 +69,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h
index 8c8dac5..3b1fec7 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h
@@ -27,7 +27,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -70,6 +70,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_UNTIL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h
index b903953..6782717 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -76,6 +76,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h
index b617500..95a0a82 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -84,6 +84,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_IS_PERMUTATION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h
index ce3032f..50c97ba 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -56,6 +56,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h
index 17fc42e..f139d03 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -71,6 +71,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_UNTIL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h
index 3ac6b31..9a92030 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h
@@ -18,7 +18,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -46,6 +46,6 @@
} // namespace ranges
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h
index 2972e32..c51f4d7 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -93,6 +93,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h
index 78cbb6d..7435639 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h
@@ -27,7 +27,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -61,6 +61,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h
index f25c7ab..7f92fa3 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h
@@ -32,7 +32,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -75,6 +75,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MAKE_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h
index 55aef99..2fd2970 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h
@@ -20,6 +20,7 @@
#include <__iterator/projected.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
+#include <__type_traits/is_trivially_copyable.h>
#include <__utility/move.h>
#include <initializer_list>
@@ -27,7 +28,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -40,7 +41,10 @@
template <class _Tp, class _Proj = identity,
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const {
+ const _Tp& operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
+ _LIBCPP_LIFETIMEBOUND const _Tp& __b,
+ _Comp __comp = {},
+ _Proj __proj = {}) const {
return std::invoke(__comp, std::invoke(__proj, __a), std::invoke(__proj, __b)) ? __b : __a;
}
@@ -64,7 +68,7 @@
_LIBCPP_ASSERT(__first != __last, "range must contain at least one element");
- if constexpr (forward_range<_Rp>) {
+ if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); };
return *ranges::__min_element_impl(std::move(__first), std::move(__last), __comp_lhs_rhs_swapped, __proj);
} else {
@@ -88,6 +92,6 @@
_LIBCPP_POP_MACROS
-#endif // _LIBCPP_STD_VER > 17 &&
+#endif // _LIBCPP_STD_VER >= 20 &&
#endif // _LIBCPP___ALGORITHM_RANGES_MAX_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h
index 490f320..39e86d3 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -56,6 +56,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MAX_ELEMENT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h
index b36a05a..c5797b0 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h
@@ -20,14 +20,14 @@
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/dangling.h>
+#include <__type_traits/remove_cvref.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
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -137,6 +137,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MERGE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h
index 0e31f57..5e941a1 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h
@@ -20,13 +20,14 @@
#include <__iterator/projected.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
+#include <__type_traits/is_trivially_copyable.h>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -39,7 +40,10 @@
template <class _Tp, class _Proj = identity,
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const {
+ const _Tp& operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
+ _LIBCPP_LIFETIMEBOUND const _Tp& __b,
+ _Comp __comp = {},
+ _Proj __proj = {}) const {
return std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)) ? __b : __a;
}
@@ -58,10 +62,8 @@
range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
-
_LIBCPP_ASSERT(__first != __last, "range must contain at least one element");
-
- if constexpr (forward_range<_Rp>) {
+ if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
return *ranges::__min_element_impl(__first, __last, __comp, __proj);
} else {
range_value_t<_Rp> __result = *__first;
@@ -84,6 +86,6 @@
_LIBCPP_POP_MACROS
-#endif // _LIBCPP_STD_VER > 17 &&
+#endif // _LIBCPP_STD_VER >= 20 &&
#endif // _LIBCPP___ALGORITHM_RANGES_MIN_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h
index 1751874..4c58adb 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -32,7 +32,7 @@
// 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
+_LIBCPP_HIDE_FROM_ABI constexpr
_Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
if (__first == __last)
return __first;
@@ -69,6 +69,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
index f82e005..86540cc 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
@@ -13,11 +13,13 @@
#include <__algorithm/minmax_element.h>
#include <__assert>
#include <__concepts/copyable.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/next.h>
#include <__iterator/projected.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
@@ -30,7 +32,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -46,7 +48,10 @@
template <class _Type, class _Proj = identity,
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<const _Type&>
- operator()(const _Type& __a, const _Type& __b, _Comp __comp = {}, _Proj __proj = {}) const {
+ operator()(_LIBCPP_LIFETIMEBOUND const _Type& __a,
+ _LIBCPP_LIFETIMEBOUND const _Type& __b,
+ _Comp __comp = {},
+ _Proj __proj = {}) const {
if (std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)))
return {__b, __a};
return {__a, __b};
@@ -73,6 +78,18 @@
_LIBCPP_ASSERT(__first != __last, "range has to contain at least one element");
if constexpr (forward_range<_Range>) {
+ // Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator
+ // dereference when doing so might not be idempotent. The `if constexpr` avoids the extra branch in cases where
+ // it's not needed.
+ if constexpr (!same_as<remove_cvref_t<range_reference_t<_Range>>, _ValueT> ||
+ is_rvalue_reference_v<range_reference_t<_Range>>) {
+ if (ranges::next(__first) == __last) {
+ // During initialization, members are allowed to refer to already initialized members
+ // (see http://eel.is/c++draft/dcl.init.aggr#6)
+ minmax_result<_ValueT> __result = {*__first, __result.min};
+ return __result;
+ }
+ }
auto __result = std::__minmax_element_impl(__first, __last, __comp, __proj);
return {*__result.first, *__result.second};
} else {
@@ -83,6 +100,8 @@
std::invoke(__proj, std::forward<decltype(__b)>(__b)));
};
+ // During initialization, members are allowed to refer to already initialized members
+ // (see http://eel.is/c++draft/dcl.init.aggr#6)
ranges::minmax_result<_ValueT> __result = {*__first, __result.min};
if (__first == __last || ++__first == __last)
return __result;
@@ -129,6 +148,6 @@
_LIBCPP_POP_MACROS
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h
index 6699f96..cbf3505 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h
@@ -23,13 +23,12 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -67,6 +66,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h
index 4fd0517..098c415 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h
@@ -27,7 +27,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
namespace ranges {
@@ -78,7 +78,7 @@
} // namespace __cpo
} // namespace ranges
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h
index 46a0970..5e06e90 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -66,6 +66,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MOVE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h
index d4e8eb1..95c2c66 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -68,6 +68,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h
index 6c8e8e1..9ebab3e 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h
@@ -28,7 +28,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -68,6 +68,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_NEXT_PERMUTATION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h
index b39e570..39940ad 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h
@@ -22,7 +22,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -63,6 +63,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_NONE_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h
index d9ec4f1..96bf33b 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h
@@ -31,7 +31,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -75,6 +75,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_NTH_ELEMENT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h
index 3ea0a7f..4562c35 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h
@@ -33,7 +33,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -73,6 +73,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h
index 212db55..5401a37 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h
@@ -30,7 +30,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -87,6 +87,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h
index 8b3aae5..de839de 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h
@@ -27,13 +27,12 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -78,6 +77,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h
index e7a9a34..a271428 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h
@@ -20,13 +20,12 @@
#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
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -93,6 +92,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h
index 2bd118d..129ebb6 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h
@@ -27,7 +27,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -83,6 +83,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h
index 65beec8..54ea97d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h
@@ -32,7 +32,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -76,6 +76,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_POP_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h
index 6866d90..bf06287 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h
@@ -28,7 +28,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -72,6 +72,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PREV_PERMUTATION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h
index a1f4347..6e65d11 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h
@@ -32,7 +32,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -75,6 +75,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_PUSH_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h
index dd5c5fb..6dd48e0 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -59,6 +59,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h
index 2102228..a9a19c1 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h
@@ -26,7 +26,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -71,6 +71,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h
index 4fc6745..e6d043e 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h
@@ -29,7 +29,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -85,6 +85,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h
index 1f17467..7507c21 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h
@@ -27,7 +27,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -80,6 +80,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h
index 8b12bea..258e25d 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -69,6 +69,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h
index f87a236..79eaebb 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h
@@ -26,7 +26,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -86,6 +86,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h
index b8741ec..8ff2eba 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -88,6 +88,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h
index 65be3c7..2b7dda9 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -72,6 +72,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h
index e2a5d9a..801fccb 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h
@@ -22,7 +22,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -78,6 +78,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h
index a84b1ad..c230399 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -62,6 +62,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h
index 91ed402..99e6ca6 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -66,6 +66,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h
index 52f403c..5b9321f 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h
@@ -23,7 +23,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -63,6 +63,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h
index a37cb64..a5ff2d0 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h
@@ -19,15 +19,15 @@
#include <__random/uniform_random_bit_generator.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
+#include <__type_traits/remove_reference.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
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -69,6 +69,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SAMPLE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h
index 388d5af..6d3e318 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h
@@ -28,7 +28,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -130,6 +130,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h
index 56ec8f3..ed5ec34 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h
@@ -31,7 +31,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -112,6 +112,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h
index 607dd68..6b9af87 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h
@@ -30,7 +30,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -102,5 +102,5 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SET_DIFFERENCE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h
index aa9fd24..5848656 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h
@@ -28,7 +28,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -113,5 +113,5 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SET_INTERSECTION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h
index bc4a906..f8bcf37 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h
@@ -28,7 +28,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -113,5 +113,5 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h
index f8cd45c..bc669cc 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h
@@ -31,7 +31,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -116,6 +116,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SET_UNION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h
index a2f2c0e..2f45fb0 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h
@@ -23,15 +23,15 @@
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/dangling.h>
+#include <__type_traits/remove_reference.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
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -66,6 +66,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h
index 32391df..60305b1 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h
@@ -31,7 +31,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -74,6 +74,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SORT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h
index 9feb0f6..b40eef9 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h
@@ -32,7 +32,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -75,6 +75,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SORT_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h
index c3469f1..77bef85 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h
@@ -26,15 +26,15 @@
#include <__ranges/concepts.h>
#include <__ranges/dangling.h>
#include <__ranges/subrange.h>
+#include <__type_traits/remove_cvref.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
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -83,6 +83,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h
index d3c48dd..b823e3b 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h
@@ -31,7 +31,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -74,6 +74,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_STABLE_SORT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h
index 552fd55..34124db 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h
@@ -24,7 +24,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -63,6 +63,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h
index c0981a0..1bba756 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h
@@ -26,7 +26,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -165,6 +165,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_TRANSFORM_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h
index be427cc..9e05c09 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h
@@ -32,7 +32,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -74,6 +74,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h
index 3ad47b0..2aaa879 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h
@@ -33,7 +33,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -111,6 +111,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h
index a134080..43ce89b 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h
@@ -25,7 +25,7 @@
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -70,6 +70,6 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_UPPER_BOUND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/rotate.h b/third_party/llvm-project/libcxx/include/__algorithm/rotate.h
index 8934ce0..7ed6f18 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/rotate.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/rotate.h
@@ -15,9 +15,9 @@
#include <__algorithm/swap_ranges.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_trivially_move_assignable.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/sample.h b/third_party/llvm-project/libcxx/include/__algorithm/sample.h
index f403ba6..7a05e45 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/sample.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/sample.h
@@ -16,8 +16,8 @@
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__random/uniform_int_distribution.h>
+#include <__type_traits/common_type.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -88,7 +88,7 @@
__g, _PopIterCategory());
}
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
template <class _PopulationIterator, class _SampleIterator, class _Distance,
class _UniformRandomNumberGenerator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -103,7 +103,7 @@
std::move(__first), std::move(__last), std::move(__output_iter), __n, __g);
}
-#endif // _LIBCPP_STD_VER > 14
+#endif // _LIBCPP_STD_VER >= 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/search.h b/third_party/llvm-project/libcxx/include/__algorithm/search.h
index 93771be..c9012d7 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/search.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/search.h
@@ -14,12 +14,13 @@
#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__functional/identity.h>
+#include <__functional/invoke.h>
#include <__iterator/advance.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/enable_if.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
@@ -187,7 +188,7 @@
return std::search(__first1, __last1, __first2, __last2, __equal_to());
}
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
template <class _ForwardIterator, class _Searcher>
_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher& __s) {
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/search_n.h b/third_party/llvm-project/libcxx/include/__algorithm/search_n.h
index 60a0735..06962be 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/search_n.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/search_n.h
@@ -14,14 +14,15 @@
#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__functional/identity.h>
+#include <__functional/invoke.h>
#include <__iterator/advance.h>
#include <__iterator/concepts.h>
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/concepts.h>
+#include <__type_traits/is_callable.h>
#include <__utility/convert_to_integral.h>
#include <__utility/pair.h>
-#include <type_traits> // __convert_to_integral
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h b/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h
index cffdc8f..5a7d3bc 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h
@@ -17,9 +17,9 @@
#include <__functional/identity.h>
#include <__functional/invoke.h>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/remove_cvref.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h b/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h
index 33f06d5..403317e 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h
@@ -12,7 +12,6 @@
#include <__algorithm/move.h>
#include <__config>
#include <__iterator/iterator_traits.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -20,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY constexpr
@@ -49,7 +48,7 @@
return _VSTD::move(__m, __last, __first);
}
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h b/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h
index 14bc761..751e690 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h
@@ -15,7 +15,6 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/swap.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -23,7 +22,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY constexpr
@@ -95,7 +94,7 @@
}
}
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/sort.h b/third_party/llvm-project/libcxx/include/__algorithm/sort.h
index a7d2d55..f870612 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/sort.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/sort.h
@@ -26,9 +26,8 @@
#include <__functional/operations.h>
#include <__functional/ranges_operations.h>
#include <__iterator/iterator_traits.h>
-#include <__memory/destruct_n.h>
-#include <__memory/unique_ptr.h>
#include <__type_traits/conditional.h>
+#include <__type_traits/disjunction.h>
#include <__type_traits/is_arithmetic.h>
#include <__utility/move.h>
#include <__utility/pair.h>
@@ -41,52 +40,6 @@
_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_SINCE_CXX14
- _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_SINCE_CXX14 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_SINCE_CXX14 static
- _Comp __get_comp(_Wrapped& __w) { return __w.__comp; }
-};
-
// stable, 2-3 compares, 0-2 swaps
template <class _AlgPolicy, class _Compare, class _ForwardIterator>
@@ -130,65 +83,41 @@
template <class _AlgPolicy, class _Compare, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI
-unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4,
+void __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4,
_Compare __c) {
using _Ops = _IterOps<_AlgPolicy>;
- unsigned __r = std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
+ std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
if (__c(*__x4, *__x3)) {
_Ops::iter_swap(__x3, __x4);
- ++__r;
if (__c(*__x3, *__x2)) {
_Ops::iter_swap(__x2, __x3);
- ++__r;
if (__c(*__x2, *__x1)) {
_Ops::iter_swap(__x1, __x2);
- ++__r;
}
}
}
- return __r;
}
// stable, 4-10 compares, 0-9 swaps
-template <class _WrappedComp, class _ForwardIterator>
-_LIBCPP_HIDDEN unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
- _ForwardIterator __x4, _ForwardIterator __x5, _WrappedComp __wrapped_comp) {
- using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
- using _AlgPolicy = typename _Unwrap::_AlgPolicy;
+template <class _AlgPolicy, class _Comp, class _ForwardIterator>
+_LIBCPP_HIDE_FROM_ABI void __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
+ _ForwardIterator __x4, _ForwardIterator __x5, _Comp __comp) {
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)) {
+ std::__sort4<_AlgPolicy, _Comp>(__x1, __x2, __x3, __x4, __comp);
+ if (__comp(*__x5, *__x4)) {
_Ops::iter_swap(__x4, __x5);
- ++__r;
- if (__c(*__x4, *__x3)) {
+ if (__comp(*__x4, *__x3)) {
_Ops::iter_swap(__x3, __x4);
- ++__r;
- if (__c(*__x3, *__x2)) {
+ if (__comp(*__x3, *__x2)) {
_Ops::iter_swap(__x2, __x3);
- ++__r;
- if (__c(*__x2, *__x1)) {
+ if (__comp(*__x2, *__x1)) {
_Ops::iter_swap(__x1, __x2);
- ++__r;
}
}
}
}
- return __r;
-}
-
-template <class _AlgPolicy, class _Compare, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI 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, _ForwardIterator>(
- 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.
@@ -200,7 +129,7 @@
struct __is_simple_comparator<less<_Tp>&> : true_type {};
template <class _Tp>
struct __is_simple_comparator<greater<_Tp>&> : true_type {};
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
template <>
struct __is_simple_comparator<ranges::less&> : true_type {};
template <>
@@ -299,7 +228,8 @@
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) {
- std::__sort5_wrap_policy<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __x5, __c);
+ std::__sort5<_AlgPolicy, _Compare, _RandomAccessIterator>(
+ std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __c);
}
// Assumes size > 0
@@ -344,7 +274,7 @@
// Sort the iterator range [__first, __last) using the comparator __comp using
// the insertion sort algorithm. Insertion sort has two loops, outer and inner.
-// The implementation below has not bounds check (unguarded) for the inner loop.
+// The implementation below has no bounds check (unguarded) for the inner loop.
// Assumes that there is an element in the position (__first - 1) and that each
// element in the input range is greater or equal to the element at __first - 1.
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
@@ -370,16 +300,11 @@
}
}
-template <class _WrappedComp, class _RandomAccessIterator>
-_LIBCPP_HIDDEN bool __insertion_sort_incomplete(
- _RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
- using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
- using _AlgPolicy = typename _Unwrap::_AlgPolicy;
+template <class _AlgPolicy, class _Comp, class _RandomAccessIterator>
+_LIBCPP_HIDE_FROM_ABI bool __insertion_sort_incomplete(
+ _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
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:
@@ -390,21 +315,21 @@
_Ops::iter_swap(__first, __last);
return true;
case 3:
- std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), --__last, __comp);
+ std::__sort3_maybe_branchless<_AlgPolicy, _Comp>(__first, __first + difference_type(1), --__last, __comp);
return true;
case 4:
- std::__sort4_maybe_branchless<_AlgPolicy, _Compare>(
+ std::__sort4_maybe_branchless<_AlgPolicy, _Comp>(
__first, __first + difference_type(1), __first + difference_type(2), --__last, __comp);
return true;
case 5:
- std::__sort5_maybe_branchless<_AlgPolicy, _Compare>(
+ std::__sort5_maybe_branchless<_AlgPolicy, _Comp>(
__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);
- std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), __j, __comp);
+ std::__sort3_maybe_branchless<_AlgPolicy, _Comp>(__first, __first + difference_type(1), __j, __comp);
const unsigned __limit = 8;
unsigned __count = 0;
for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) {
@@ -425,37 +350,6 @@
return true;
}
-template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-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(_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(std::move(*__i2));
- __d.template __incr<value_type>();
- for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2)
- *__j2 = std::move(*__i2);
- *__j2 = _Ops::__iter_move(__first1);
- } else {
- ::new ((void*)__j2) value_type(_Ops::__iter_move(__first1));
- __d.template __incr<value_type>();
- }
- }
- __h.release();
- }
-}
-
template <class _AlgPolicy, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos(
_RandomAccessIterator __first, _RandomAccessIterator __last, uint64_t& __left_bitset, uint64_t& __right_bitset) {
@@ -464,11 +358,11 @@
// Swap one pair on each iteration as long as both bitsets have at least one
// element for swapping.
while (__left_bitset != 0 && __right_bitset != 0) {
- difference_type tz_left = __libcpp_ctz(__left_bitset);
- __left_bitset = __libcpp_blsr(__left_bitset);
- difference_type tz_right = __libcpp_ctz(__right_bitset);
- __right_bitset = __libcpp_blsr(__right_bitset);
- _Ops::iter_swap(__first + tz_left, __last - tz_right);
+ difference_type __tz_left = __libcpp_ctz(__left_bitset);
+ __left_bitset = __libcpp_blsr(__left_bitset);
+ difference_type __tz_right = __libcpp_ctz(__right_bitset);
+ __right_bitset = __libcpp_blsr(__right_bitset);
+ _Ops::iter_swap(__first + __tz_left, __last - __tz_right);
}
}
@@ -533,9 +427,9 @@
// Record the comparison outcomes for the elements currently on the left side.
if (__left_bitset == 0) {
_RandomAccessIterator __iter = __first;
- for (int j = 0; j < __l_size; j++) {
+ for (int __j = 0; __j < __l_size; __j++) {
bool __comp_result = !__comp(*__iter, __pivot);
- __left_bitset |= (static_cast<uint64_t>(__comp_result) << j);
+ __left_bitset |= (static_cast<uint64_t>(__comp_result) << __j);
++__iter;
}
}
@@ -543,9 +437,9 @@
// side.
if (__right_bitset == 0) {
_RandomAccessIterator __iter = __lm1;
- for (int j = 0; j < __r_size; j++) {
+ for (int __j = 0; __j < __r_size; __j++) {
bool __comp_result = __comp(*__iter, __pivot);
- __right_bitset |= (static_cast<uint64_t>(__comp_result) << j);
+ __right_bitset |= (static_cast<uint64_t>(__comp_result) << __j);
--__iter;
}
}
@@ -565,9 +459,9 @@
while (__left_bitset != 0) {
difference_type __tz_left = __detail::__block_size - 1 - __libcpp_clz(__left_bitset);
__left_bitset &= (static_cast<uint64_t>(1) << __tz_left) - 1;
- _RandomAccessIterator it = __first + __tz_left;
- if (it != __lm1) {
- _Ops::iter_swap(it, __lm1);
+ _RandomAccessIterator __it = __first + __tz_left;
+ if (__it != __lm1) {
+ _Ops::iter_swap(__it, __lm1);
}
--__lm1;
}
@@ -578,9 +472,9 @@
while (__right_bitset != 0) {
difference_type __tz_right = __detail::__block_size - 1 - __libcpp_clz(__right_bitset);
__right_bitset &= (static_cast<uint64_t>(1) << __tz_right) - 1;
- _RandomAccessIterator it = __lm1 - __tz_right;
- if (it != __first) {
- _Ops::iter_swap(it, __first);
+ _RandomAccessIterator __it = __lm1 - __tz_right;
+ if (__it != __first) {
+ _Ops::iter_swap(__it, __first);
}
++__first;
}
@@ -862,10 +756,8 @@
// [__first, __i) < *__i and *__i <= [__i+1, __last)
// If we were given a perfect partition, see if insertion sort is quick...
if (__ret.second) {
- 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)) {
+ bool __fs = std::__insertion_sort_incomplete<_AlgPolicy, _Compare>(__first, __i, __comp);
+ if (std::__insertion_sort_incomplete<_AlgPolicy, _Compare>(__i + difference_type(1), __last, __comp)) {
if (__fs)
return;
__last = __i;
@@ -904,30 +796,8 @@
return __log2;
}
-template <class _WrappedComp, class _RandomAccessIterator>
-_LIBCPP_HIDDEN void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- difference_type __depth_limit = 2 * std::__log2i(__last - __first);
-
- using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
- using _AlgPolicy = typename _Unwrap::_AlgPolicy;
- using _Compare = typename _Unwrap::_Comp;
- _Compare __comp = _Unwrap::__get_comp(__wrapped_comp);
- // Only use bitset partitioning for arithmetic types. We should also check
- // that the default comparator is in use so that we are sure that there are no
- // branches in the comparator.
- std::__introsort<_AlgPolicy,
- _Compare,
- _RandomAccessIterator,
- __use_branchless_sort<_Compare, _RandomAccessIterator>::value>(
- __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;
- std::__sort<__less<uintptr_t>&, uintptr_t*>((uintptr_t*)__first, (uintptr_t*)__last, __comp);
-}
+template <class _Comp, class _RandomAccessIterator>
+void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp);
extern template _LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -947,40 +817,83 @@
extern template _LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
extern template _LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
-#endif
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&);
-extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
+template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ difference_type __depth_limit = 2 * std::__log2i(__last - __first);
-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>&);
+ // Only use bitset partitioning for arithmetic types. We should also check
+ // that the default comparator is in use so that we are sure that there are no
+ // branches in the comparator.
+ std::__introsort<_AlgPolicy,
+ _Comp&,
+ _RandomAccessIterator,
+ __use_branchless_sort<_Comp, _RandomAccessIterator>::value>(
+ __first, __last, __comp, __depth_limit);
+}
+
+template <class _Type, class... _Options>
+using __is_any_of = _Or<is_same<_Type, _Options>...>;
+
+template <class _Type>
+using __sort_is_specialized_in_library = __is_any_of<
+ _Type,
+ char,
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+ wchar_t,
+#endif
+ signed char,
+ unsigned char,
+ short,
+ unsigned short,
+ int,
+ unsigned int,
+ long,
+ unsigned long,
+ long long,
+ unsigned long long,
+ float,
+ double,
+ long double>;
+
+template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, __less<_Type>& __comp) {
+ std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
+}
+
+template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, less<_Type>&) {
+ __less<_Type> __comp;
+ std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
+}
+
+#if _LIBCPP_STD_VER >= 14
+template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, less<>&) {
+ __less<_Type> __comp;
+ std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
+}
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, ranges::less&) {
+ __less<_Type> __comp;
+ std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp);
+}
+#endif
template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
- using _Comp_ref = __comp_ref_type<_Comp>;
if (__libcpp_is_constant_evaluated()) {
- std::__partial_sort<_AlgPolicy>(__first, __last, __last, __comp);
-
+ std::__partial_sort<_AlgPolicy>(
+ std::__unwrap_iter(__first), std::__unwrap_iter(__last), std::__unwrap_iter(__last), __comp);
} else {
- 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);
+ std::__sort_dispatch<_AlgPolicy>(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __comp);
}
}
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h
index 8249407..0dc9acc 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h
@@ -15,8 +15,9 @@
#include <__algorithm/pop_heap.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_copy_assignable.h>
+#include <__type_traits/is_copy_constructible.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h b/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h
index a49de6d..3b68bd3 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h
@@ -21,7 +21,6 @@
#include <__utility/move.h>
#include <__utility/pair.h>
#include <new>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h
index 8e70978..0c9daa2 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h
@@ -19,10 +19,10 @@
#include <__memory/destruct_n.h>
#include <__memory/temporary_buffer.h>
#include <__memory/unique_ptr.h>
+#include <__type_traits/is_trivially_copy_assignable.h>
#include <__utility/move.h>
#include <__utility/pair.h>
#include <new>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -30,6 +30,37 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
+_LIBCPP_HIDE_FROM_ABI
+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(_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(std::move(*__i2));
+ __d.template __incr<value_type>();
+ for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2)
+ *__j2 = std::move(*__i2);
+ *__j2 = _Ops::__iter_move(__first1);
+ } else {
+ ::new ((void*)__j2) value_type(_Ops::__iter_move(__first1));
+ __d.template __incr<value_type>();
+ }
+ }
+ __h.release();
+ }
+}
+
template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2>
_LIBCPP_HIDE_FROM_ABI void
__merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h b/third_party/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h
new file mode 100644
index 0000000..10396e0
--- /dev/null
+++ b/third_party/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_THREE_WAY_COMP_REF_TYPE_H
+#define _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H
+
+#include <__compare/ordering.h>
+#include <__config>
+#include <__debug>
+#include <__utility/declval.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Comp>
+struct __debug_three_way_comp {
+ _Comp& __comp_;
+ _LIBCPP_HIDE_FROM_ABI constexpr __debug_three_way_comp(_Comp& __c) : __comp_(__c) {}
+
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __x, _Up& __y) {
+ auto __r = __comp_(__x, __y);
+ __do_compare_assert(0, __y, __x, __r);
+ return __r;
+ }
+
+ template <class _LHS, class _RHS, class _Order>
+ _LIBCPP_HIDE_FROM_ABI constexpr inline void __do_compare_assert(int, _LHS& __l, _RHS& __r, _Order __o)
+ requires __comparison_category<decltype(std::declval<_Comp&>()(std::declval<_LHS&>(), std::declval<_RHS&>()))>
+ {
+ _Order __expected = __o;
+ if (__o == _Order::less)
+ __expected = _Order::greater;
+ if (__o == _Order::greater)
+ __expected = _Order::less;
+ _LIBCPP_DEBUG_ASSERT(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
+ (void)__l;
+ (void)__r;
+ (void)__expected;
+ }
+
+ template <class _LHS, class _RHS, class _Order>
+ _LIBCPP_HIDE_FROM_ABI constexpr inline void __do_compare_assert(long, _LHS&, _RHS&, _Order) {}
+};
+
+// Pass the comparator by lvalue reference. Or in debug mode, using a
+// debugging wrapper that stores a reference.
+# ifndef _LIBCPP_ENABLE_DEBUG_MODE
+template <class _Comp>
+using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
+# else
+template <class _Comp>
+using __three_way_comp_ref_type = _Comp&;
+# endif
+
+#endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h b/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
index 1e86074..1f20399 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
@@ -11,13 +11,13 @@
#include <__config>
#include <__functional/invoke.h>
-#include <type_traits>
+#include <__type_traits/remove_cvref.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -57,6 +57,6 @@
_LIBCPP_POP_MACROS
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP___ALGORITHM_RANGES_UNIFORM_RANDOM_BIT_GENERATOR_ADAPTOR_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
index 0f661e1..81f2942 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
@@ -64,6 +64,14 @@
return _Impl::__unwrap(__i);
}
+// Allow input_iterators to be passed to __unwrap_iter (but not __rewrap_iter)
+#if _LIBCPP_STD_VER >= 20
+template <class _Iter, __enable_if_t<!is_copy_constructible<_Iter>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI constexpr _Iter __unwrap_iter(_Iter __i) noexcept {
+ return __i;
+}
+#endif
+
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));
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h
index 2c5d23e..2c75c8f 100644
--- a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h
+++ b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h
@@ -28,7 +28,7 @@
// __unwrap_iter and __rewrap_iter don't work for this, because they assume that the iterator and sentinel have
// the same type. __unwrap_range tries to get two iterators and then forward to __unwrap_iter.
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
template <class _Iter, class _Sent>
struct __unwrap_range_impl {
_LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __sent)
@@ -43,7 +43,7 @@
}
_LIBCPP_HIDE_FROM_ABI static constexpr auto
- __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(__orig_iter)) __iter)
+ __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(std::move(__orig_iter))) __iter)
requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>
{
return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter));
@@ -80,7 +80,7 @@
_LIBCPP_HIDE_FROM_ABI constexpr _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) {
return __unwrap_range_impl<_Iter, _Sent>::__rewrap(std::move(__orig_iter), std::move(__iter));
}
-#else // _LIBCPP_STD_VER > 17
+#else // _LIBCPP_STD_VER >= 20
template <class _Iter, class _Unwrapped = decltype(std::__unwrap_iter(std::declval<_Iter>()))>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair<_Unwrapped, _Unwrapped> __unwrap_range(_Iter __first, _Iter __last) {
return std::make_pair(std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last)));
@@ -90,7 +90,7 @@
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) {
return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter));
}
-#endif // _LIBCPP_STD_VER > 17
+#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD