aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/__algorithm
diff options
context:
space:
mode:
authorAndrey Khalyavin <halyavin@gmail.com>2022-06-24 01:36:20 +0300
committerAndrey Khalyavin <halyavin@gmail.com>2022-06-24 01:36:20 +0300
commit744d10b39ed56155025137ac4a38e11e72ae7d4a (patch)
tree07bcc252ab4cd4b4c92aa5e7e1c90215e11db7c7 /contrib/libs/cxxsupp/libcxx/include/__algorithm
parentfd274bd81aff99a065469b0c1a0f581b1d401c79 (diff)
downloadydb-744d10b39ed56155025137ac4a38e11e72ae7d4a.tar.gz
Update libc++ to 8f0b2ac1 (12 Feb 2022).
Notable changes: * use [[no_unique_address]] for field `__base_` in join_view * remove _LIBCPP_HIDE_FROM_ABI from __threading_support functions * remove __functional_base header which is just a set of #include directives * remove unused include in ranges_swap_ranges.h * do not print bools with "c" format. * add noexcept to basic_format_context::arg constructor * add ranges::min_element * add ranges::in_fun_result * add ranges::swap_ranges * add std::vector::reference::operator=(bool) const * replace _LIBCPP_DEBUG with _LIBCPP_DEBUG_LEVEL * fix constexpr in __debug_less * modernize code in compress_pair.h * add permutable concept * cleanup format headers * remove _LIBCPP_ABI_UNSTABLE, we must set _LIBCPP_ABI_VERSION and _LIBCPP_ABI_NAMESPACE outselves now * make some members private in experimental/functional * remove std::nullptr_t emulation in C++03 mode ref:f3c7583f32067a3dd9da42aeb15f1b01d746dc59
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__algorithm')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h25
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h49
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h72
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h69
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h1
5 files changed, 200 insertions, 16 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h
index bb81dd71c8..40526f6efd 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h
@@ -10,11 +10,8 @@
#define _LIBCPP___ALGORITHM_COMP_REF_TYPE_H
#include <__config>
-
-#ifdef _LIBCPP_DEBUG
-# include <__debug>
-# include <__utility/declval.h>
-#endif
+#include <__debug>
+#include <__utility/declval.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -22,17 +19,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifdef _LIBCPP_DEBUG
-
template <class _Compare>
struct __debug_less
{
_Compare &__comp_;
- _LIBCPP_CONSTEXPR_AFTER_CXX17
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
__debug_less(_Compare& __c) : __comp_(__c) {}
template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_AFTER_CXX17
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _Tp& __x, const _Up& __y)
{
bool __r = __comp_(__x, __y);
@@ -42,7 +37,7 @@ struct __debug_less
}
template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_AFTER_CXX17
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(_Tp& __x, _Up& __y)
{
bool __r = __comp_(__x, __y);
@@ -52,28 +47,28 @@ struct __debug_less
}
template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_AFTER_CXX17
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
decltype((void)declval<_Compare&>()(
declval<_LHS const&>(), declval<_RHS const&>()))
__do_compare_assert(int, _LHS & __l, _RHS & __r) {
_LIBCPP_ASSERT(!__comp_(__l, __r),
"Comparator does not induce a strict weak ordering");
+ (void)__l;
+ (void)__r;
}
template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_AFTER_CXX17
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
void __do_compare_assert(long, _LHS &, _RHS &) {}
};
-#endif // _LIBCPP_DEBUG
-
template <class _Comp>
struct __comp_ref_type {
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-#ifndef _LIBCPP_DEBUG
+#if _LIBCPP_DEBUG_LEVEL == 0
typedef _Comp& type;
#else
typedef __debug_less<_Comp> type;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h
new file mode 100644
index 0000000000..d5186e11b7
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_fun_result.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_IN_FUN_RESULT_H
+#define _LIBCPP___ALGORITHM_IN_FUN_RESULT_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_CONCEPTS
+
+namespace ranges {
+template <class _Ip, class _Fp>
+struct in_fun_result {
+ _LIBCPP_NO_UNIQUE_ADDRESS _Ip in;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Fp fun;
+
+ template <class _I2, class _F2>
+ requires convertible_to<const _Ip&, _I2> && convertible_to<const _Fp&, _F2>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_I2, _F2>() const & {
+ return {in, fun};
+ }
+
+ template <class _I2, class _F2>
+ requires convertible_to<_Ip, _I2> && convertible_to<_Fp, _F2>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_I2, _F2>() && {
+ return {std::move(in), std::move(fun)};
+ }
+};
+} // namespace ranges
+
+#endif // _LIBCPP_HAS_NO_RANGES
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___ALGORITHM_IN_FUN_RESULT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h
new file mode 100644
index 0000000000..2af503dabf
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H
+#define _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H
+
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__functional/ranges_operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/forward.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_HAS_NO_CONCEPTS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __min_element {
+struct __fn {
+ template <class _Ip, class _Sp, class _Proj, class _Comp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr
+ _Ip __go(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
+ if (__first == __last)
+ return __first;
+
+ _Ip __i = __first;
+ while (++__i != __last)
+ if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first)))
+ __first = __i;
+ return __first;
+ }
+
+ template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
+ indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ return __go(__first, __last, __comp, __proj);
+ }
+
+ template <forward_range _Rp, class _Proj = identity,
+ indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ return __go(ranges::begin(__r), ranges::end(__r), __comp, __proj);
+ }
+};
+} // namespace __min_element
+
+inline namespace __cpo {
+ inline constexpr auto min_element = __min_element::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_NO_RANGES
+
+#endif // _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h
new file mode 100644
index 0000000000..59a875ae3b
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H
+#define _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H
+
+#include <__algorithm/in_in_result.h>
+#include <__config>
+#include <__iterator/concepts.h>
+#include <__iterator/iter_swap.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_HAS_NO_CONCEPTS
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _I1, class _I2>
+using swap_ranges_result = in_in_result<_I1, _I2>;
+
+namespace __swap_ranges {
+struct __fn {
+ template <input_iterator _I1, sentinel_for<_I1> _S1,
+ input_iterator _I2, sentinel_for<_I2> _S2>
+ requires indirectly_swappable<_I1, _I2>
+ _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2>
+ operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const {
+ while (__first1 != __last1 && __first2 != __last2) {
+ ranges::iter_swap(__first1, __first2);
+ ++__first1;
+ ++__first2;
+ }
+ return {_VSTD::move(__first1), _VSTD::move(__first2)};
+ }
+
+ template <input_range _R1, input_range _R2>
+ requires indirectly_swappable<iterator_t<_R1>, iterator_t<_R2>>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ swap_ranges_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
+ operator()(_R1&& __r1, _R2&& __r2) const {
+ return operator()(ranges::begin(__r1), ranges::end(__r1),
+ ranges::begin(__r2), ranges::end(__r2));
+ }
+};
+} // namespace __swap_ranges
+
+inline namespace __cpo {
+ inline constexpr auto swap_ranges = __swap_ranges::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_NO_RANGES
+
+#endif // _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h
index b17ee896b1..0422265bb4 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/swap_ranges.h
@@ -11,7 +11,6 @@
#include <__config>
#include <__utility/swap.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header