diff options
author | hiddenpath <hiddenpath@yandex-team.com> | 2024-02-21 23:16:42 +0300 |
---|---|---|
committer | hiddenpath <hiddenpath@yandex-team.com> | 2024-02-21 23:33:25 +0300 |
commit | 9052eb5cc304b8da8885fc4e3364ebddc16945f3 (patch) | |
tree | 3c252f6161dd0745c7732d74c9304c000645ab47 /contrib/libs/cxxsupp/libcxx/include/__concepts | |
parent | f5eb715f103692e7c7536e13bef3f281fd78e5e7 (diff) | |
download | ydb-9052eb5cc304b8da8885fc4e3364ebddc16945f3.tar.gz |
Update libcxx to llvmorg-17.0.6
Update libcxx to llvmorg-17.0.6
c871ef572c71b4fef22d4a9e65bcebc57e625aea
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__concepts')
22 files changed, 226 insertions, 231 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h index 215b52aa02..f41e4c9f27 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h @@ -22,20 +22,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.arithmetic], arithmetic concepts -template<class _Tp> +template <class _Tp> concept integral = is_integral_v<_Tp>; -template<class _Tp> +template <class _Tp> concept signed_integral = integral<_Tp> && is_signed_v<_Tp>; -template<class _Tp> +template <class _Tp> concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; -template<class _Tp> +template <class _Tp> concept floating_point = is_floating_point_v<_Tp>; // Concept helpers for the internal type traits for the fundamental types. @@ -45,7 +45,7 @@ concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value; template <class _Tp> concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/assignable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/assignable.h index 91edd400ad..3f7544c934 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/assignable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/assignable.h @@ -22,19 +22,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.assignable] -template<class _Lhs, class _Rhs> +template <class _Lhs, class _Rhs> concept assignable_from = - is_lvalue_reference_v<_Lhs> && - common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> && - requires (_Lhs __lhs, _Rhs&& __rhs) { - { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>; - }; + is_lvalue_reference_v<_Lhs> && + common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> && + requires(_Lhs __lhs, _Rhs&& __rhs) { + { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>; + }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/boolean_testable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/boolean_testable.h index a96bde7117..d290e1cf3d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/boolean_testable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/boolean_testable.h @@ -19,19 +19,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.booleantestable] -template<class _Tp> +template <class _Tp> concept __boolean_testable_impl = convertible_to<_Tp, bool>; -template<class _Tp> +template <class _Tp> concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) { { !_VSTD::forward<_Tp>(__t) } -> __boolean_testable_impl; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h index c4d2f98952..c1b4a8c258 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/class_or_enum.h @@ -21,19 +21,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // Whether a type is a class type or enumeration type according to the Core wording. -template<class _Tp> +template <class _Tp> concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; // Work around Clang bug https://llvm.org/PR52970 // TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14). -template<class _Tp> +template <class _Tp> concept __workaround_52970 = is_class_v<__remove_cvref_t<_Tp>> || is_union_v<__remove_cvref_t<_Tp>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/common_reference_with.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/common_reference_with.h index cc92762d31..4eb687e071 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/common_reference_with.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/common_reference_with.h @@ -20,17 +20,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.commonref] -template<class _Tp, class _Up> +template <class _Tp, class _Up> concept common_reference_with = - same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> && - convertible_to<_Tp, common_reference_t<_Tp, _Up>> && - convertible_to<_Up, common_reference_t<_Tp, _Up>>; + same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> && + convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/common_with.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/common_with.h index 569a0ee3b7..85abb05efb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/common_with.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/common_with.h @@ -23,27 +23,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.common] -template<class _Tp, class _Up> +// clang-format off +template <class _Tp, class _Up> concept common_with = - same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> && - requires { - static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>()); - static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>()); - } && - common_reference_with< - add_lvalue_reference_t<const _Tp>, - add_lvalue_reference_t<const _Up>> && - common_reference_with< - add_lvalue_reference_t<common_type_t<_Tp, _Up>>, - common_reference_t< - add_lvalue_reference_t<const _Tp>, - add_lvalue_reference_t<const _Up>>>; - -#endif // _LIBCPP_STD_VER > 17 + same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> && + requires { + static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>()); + static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>()); + } && + common_reference_with< + add_lvalue_reference_t<const _Tp>, + add_lvalue_reference_t<const _Up>> && + common_reference_with< + add_lvalue_reference_t<common_type_t<_Tp, _Up>>, + common_reference_t< + add_lvalue_reference_t<const _Tp>, + add_lvalue_reference_t<const _Up>>>; +// clang-format on + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/constructible.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/constructible.h index 1d78eb5fd1..835a44429c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/constructible.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/constructible.h @@ -20,36 +20,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.constructible] -template<class _Tp, class... _Args> -concept constructible_from = - destructible<_Tp> && is_constructible_v<_Tp, _Args...>; +template <class _Tp, class... _Args> +concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>; // [concept.default.init] -template<class _Tp> +template <class _Tp> concept __default_initializable = requires { ::new _Tp; }; -template<class _Tp> -concept default_initializable = constructible_from<_Tp> && - requires { _Tp{}; } && __default_initializable<_Tp>; +template <class _Tp> +concept default_initializable = constructible_from<_Tp> && requires { _Tp{}; } && __default_initializable<_Tp>; // [concept.moveconstructible] -template<class _Tp> -concept move_constructible = - constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>; +template <class _Tp> +concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>; // [concept.copyconstructible] -template<class _Tp> +// clang-format off +template <class _Tp> concept copy_constructible = - move_constructible<_Tp> && - constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> && - constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && - constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; + move_constructible<_Tp> && + constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> && + constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && + constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; +// clang-format on -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h index 2c1d267410..6d5b6c1268 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h @@ -19,18 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.convertible] -template<class _From, class _To> -concept convertible_to = - is_convertible_v<_From, _To> && - requires { - static_cast<_To>(std::declval<_From>()); - }; +template <class _From, class _To> +concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(std::declval<_From>()); }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/copyable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/copyable.h index c5d8a80b9d..2bf0ad42fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/copyable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/copyable.h @@ -20,19 +20,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.object] -template<class _Tp> +// clang-format off +template <class _Tp> concept copyable = - copy_constructible<_Tp> && - movable<_Tp> && - assignable_from<_Tp&, _Tp&> && - assignable_from<_Tp&, const _Tp&> && - assignable_from<_Tp&, const _Tp>; - -#endif // _LIBCPP_STD_VER > 17 + copy_constructible<_Tp> && + movable<_Tp> && + assignable_from<_Tp&, _Tp&> && + assignable_from<_Tp&, const _Tp&> && + assignable_from<_Tp&, const _Tp>; +// clang-format on + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/derived_from.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/derived_from.h index 0d3462df6a..9875faee81 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/derived_from.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/derived_from.h @@ -19,16 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.derived] -template<class _Dp, class _Bp> -concept derived_from = - is_base_of_v<_Bp, _Dp> && - is_convertible_v<const volatile _Dp*, const volatile _Bp*>; +template <class _Dp, class _Bp> +concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/destructible.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/destructible.h index ad3819d5dc..28b4b1bc24 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/destructible.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/destructible.h @@ -18,14 +18,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.destructible] -template<class _Tp> +template <class _Tp> concept destructible = is_nothrow_destructible_v<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/different_from.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/different_from.h index 15fd8f0551..fd31f6e258 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/different_from.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/different_from.h @@ -19,12 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 -template<class _Tp, class _Up> +template <class _Tp, class _Up> concept __different_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/equality_comparable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/equality_comparable.h index b865141705..278fc76409 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/equality_comparable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/equality_comparable.h @@ -21,33 +21,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.equalitycomparable] -template<class _Tp, class _Up> +template <class _Tp, class _Up> concept __weakly_equality_comparable_with = - requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) { - { __t == __u } -> __boolean_testable; - { __t != __u } -> __boolean_testable; - { __u == __t } -> __boolean_testable; - { __u != __t } -> __boolean_testable; - }; - -template<class _Tp> + requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) { + { __t == __u } -> __boolean_testable; + { __t != __u } -> __boolean_testable; + { __u == __t } -> __boolean_testable; + { __u != __t } -> __boolean_testable; + }; + +template <class _Tp> concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>; -template<class _Tp, class _Up> +// clang-format off +template <class _Tp, class _Up> concept equality_comparable_with = - equality_comparable<_Tp> && equality_comparable<_Up> && - common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> && - equality_comparable< - common_reference_t< - __make_const_lvalue_ref<_Tp>, - __make_const_lvalue_ref<_Up>>> && - __weakly_equality_comparable_with<_Tp, _Up>; - -#endif // _LIBCPP_STD_VER > 17 + equality_comparable<_Tp> && equality_comparable<_Up> && + common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> && + equality_comparable< + common_reference_t< + __make_const_lvalue_ref<_Tp>, + __make_const_lvalue_ref<_Up>>> && + __weakly_equality_comparable_with<_Tp, _Up>; +// clang-format on + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/invocable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/invocable.h index ec39b7b817..e5be514b5c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/invocable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/invocable.h @@ -19,21 +19,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.invocable] -template<class _Fn, class... _Args> +template <class _Fn, class... _Args> concept invocable = requires(_Fn&& __fn, _Args&&... __args) { _VSTD::invoke(_VSTD::forward<_Fn>(__fn), _VSTD::forward<_Args>(__args)...); // not required to be equality preserving }; // [concept.regular.invocable] -template<class _Fn, class... _Args> +template <class _Fn, class... _Args> concept regular_invocable = invocable<_Fn, _Args...>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/movable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/movable.h index 749b78ad10..bc5b9d767c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/movable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/movable.h @@ -21,18 +21,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.object] -template<class _Tp> -concept movable = - is_object_v<_Tp> && - move_constructible<_Tp> && - assignable_from<_Tp&, _Tp> && - swappable<_Tp>; +template <class _Tp> +concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h index 7ae9783264..00731efc8f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h @@ -20,15 +20,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.predicate] -template<class _Fn, class... _Args> -concept predicate = - regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>; +template <class _Fn, class... _Args> +concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/regular.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/regular.h index d15728d298..9f3d8bf30b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/regular.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/regular.h @@ -19,14 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.object] -template<class _Tp> +template <class _Tp> concept regular = semiregular<_Tp> && equality_comparable<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/relation.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/relation.h index 7d5141cac7..7545a7db93 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/relation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/relation.h @@ -18,26 +18,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.relation] -template<class _Rp, class _Tp, class _Up> +template <class _Rp, class _Tp, class _Up> concept relation = - predicate<_Rp, _Tp, _Tp> && predicate<_Rp, _Up, _Up> && - predicate<_Rp, _Tp, _Up> && predicate<_Rp, _Up, _Tp>; + predicate<_Rp, _Tp, _Tp> && predicate<_Rp, _Up, _Up> && predicate<_Rp, _Tp, _Up> && predicate<_Rp, _Up, _Tp>; // [concept.equiv] -template<class _Rp, class _Tp, class _Up> +template <class _Rp, class _Tp, class _Up> concept equivalence_relation = relation<_Rp, _Tp, _Up>; // [concept.strictweakorder] -template<class _Rp, class _Tp, class _Up> +template <class _Rp, class _Tp, class _Up> concept strict_weak_order = relation<_Rp, _Tp, _Up>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/same_as.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/same_as.h index 554ebc3b07..4241131c70 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/same_as.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/same_as.h @@ -18,17 +18,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.same] -template<class _Tp, class _Up> +template <class _Tp, class _Up> concept __same_as_impl = _IsSame<_Tp, _Up>::value; -template<class _Tp, class _Up> +template <class _Tp, class _Up> concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/semiregular.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/semiregular.h index d15bb3ba42..7a159d17df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/semiregular.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/semiregular.h @@ -19,14 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.object] -template<class _Tp> +template <class _Tp> concept semiregular = copyable<_Tp> && default_initializable<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h index d91a7a1dc3..c1969de345 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h @@ -28,94 +28,96 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.swappable] namespace ranges { namespace __swap { - template<class _Tp> - void swap(_Tp&, _Tp&) = delete; +template <class _Tp> +void swap(_Tp&, _Tp&) = delete; - template<class _Tp, class _Up> - concept __unqualified_swappable_with = +// clang-format off +template <class _Tp, class _Up> +concept __unqualified_swappable_with = (__class_or_enum<remove_cvref_t<_Tp>> || __class_or_enum<remove_cvref_t<_Up>>) && requires(_Tp&& __t, _Up&& __u) { - swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); + swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); }; +// clang-format on - struct __fn; +struct __fn; - template<class _Tp, class _Up, size_t _Size> - concept __swappable_arrays = - !__unqualified_swappable_with<_Tp(&)[_Size], _Up(&)[_Size]> && +// clang-format off +template <class _Tp, class _Up, size_t _Size> +concept __swappable_arrays = + !__unqualified_swappable_with<_Tp (&)[_Size], _Up (&)[_Size]> && extent_v<_Tp> == extent_v<_Up> && - requires(_Tp(& __t)[_Size], _Up(& __u)[_Size], const __fn& __swap) { - __swap(__t[0], __u[0]); + requires(_Tp (&__t)[_Size], _Up (&__u)[_Size], const __fn& __swap) { + __swap(__t[0], __u[0]); }; - - template<class _Tp> - concept __exchangeable = - !__unqualified_swappable_with<_Tp&, _Tp&> && - move_constructible<_Tp> && - assignable_from<_Tp&, _Tp>; - - struct __fn { - // 2.1 `S` is `(void)swap(E1, E2)`* if `E1` or `E2` has class or enumeration type and... - // *The name `swap` is used here unqualified. - template<class _Tp, class _Up> - requires __unqualified_swappable_with<_Tp, _Up> - constexpr void operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))) - { - swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); - } - - // 2.2 Otherwise, if `E1` and `E2` are lvalues of array types with equal extent and... - template<class _Tp, class _Up, size_t _Size> - requires __swappable_arrays<_Tp, _Up, _Size> - constexpr void operator()(_Tp(& __t)[_Size], _Up(& __u)[_Size]) const - noexcept(noexcept((*this)(*__t, *__u))) - { - // TODO(cjdb): replace with `ranges::swap_ranges`. - for (size_t __i = 0; __i < _Size; ++__i) { - (*this)(__t[__i], __u[__i]); - } +// clang-format on + +template <class _Tp> +concept __exchangeable = + !__unqualified_swappable_with<_Tp&, _Tp&> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp>; + +struct __fn { + // 2.1 `S` is `(void)swap(E1, E2)`* if `E1` or `E2` has class or enumeration type and... + // *The name `swap` is used here unqualified. + template <class _Tp, class _Up> + requires __unqualified_swappable_with<_Tp, _Up> + _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))) { + swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); + } + + // 2.2 Otherwise, if `E1` and `E2` are lvalues of array types with equal extent and... + template <class _Tp, class _Up, size_t _Size> + requires __swappable_arrays<_Tp, _Up, _Size> + _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp (&__t)[_Size], _Up (&__u)[_Size]) const + noexcept(noexcept((*this)(*__t, *__u))) { + // TODO(cjdb): replace with `ranges::swap_ranges`. + for (size_t __i = 0; __i < _Size; ++__i) { + (*this)(__t[__i], __u[__i]); } - - // 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models... - template<__exchangeable _Tp> - constexpr void operator()(_Tp& __x, _Tp& __y) const - noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_assignable_v<_Tp>) - { - __y = _VSTD::exchange(__x, _VSTD::move(__y)); - } - }; + } + + // 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models... + template <__exchangeable _Tp> + _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp& __x, _Tp& __y) const + noexcept(is_nothrow_move_constructible_v<_Tp>&& is_nothrow_move_assignable_v<_Tp>) { + __y = _VSTD::exchange(__x, _VSTD::move(__y)); + } +}; } // namespace __swap inline namespace __cpo { - inline constexpr auto swap = __swap::__fn{}; +inline constexpr auto swap = __swap::__fn{}; } // namespace __cpo } // namespace ranges -template<class _Tp> +template <class _Tp> concept swappable = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); }; -template<class _Tp, class _Up> -concept swappable_with = - common_reference_with<_Tp, _Up> && - requires(_Tp&& __t, _Up&& __u) { - ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Tp>(__t)); - ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Up>(__u)); - ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); - ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Tp>(__t)); - }; +template <class _Tp, class _Up> +concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, _Up&& __u) { + ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Tp>(__t)); + ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Up>(__u)); + ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); + ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Tp>(__t)); +}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___CONCEPTS_SWAPPABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/totally_ordered.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/totally_ordered.h index f12d26b108..186c3b430d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/totally_ordered.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/totally_ordered.h @@ -21,37 +21,38 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.totallyordered] -template<class _Tp, class _Up> -concept __partially_ordered_with = - requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) { - { __t < __u } -> __boolean_testable; - { __t > __u } -> __boolean_testable; - { __t <= __u } -> __boolean_testable; - { __t >= __u } -> __boolean_testable; - { __u < __t } -> __boolean_testable; - { __u > __t } -> __boolean_testable; - { __u <= __t } -> __boolean_testable; - { __u >= __t } -> __boolean_testable; - }; - -template<class _Tp> +template <class _Tp, class _Up> +concept __partially_ordered_with = requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) { + { __t < __u } -> __boolean_testable; + { __t > __u } -> __boolean_testable; + { __t <= __u } -> __boolean_testable; + { __t >= __u } -> __boolean_testable; + { __u < __t } -> __boolean_testable; + { __u > __t } -> __boolean_testable; + { __u <= __t } -> __boolean_testable; + { __u >= __t } -> __boolean_testable; +}; + +template <class _Tp> concept totally_ordered = equality_comparable<_Tp> && __partially_ordered_with<_Tp, _Tp>; -template<class _Tp, class _Up> +// clang-format off +template <class _Tp, class _Up> concept totally_ordered_with = - totally_ordered<_Tp> && totally_ordered<_Up> && - equality_comparable_with<_Tp, _Up> && - totally_ordered< - common_reference_t< - __make_const_lvalue_ref<_Tp>, - __make_const_lvalue_ref<_Up>>> && - __partially_ordered_with<_Tp, _Up>; - -#endif // _LIBCPP_STD_VER > 17 + totally_ordered<_Tp> && totally_ordered<_Up> && + equality_comparable_with<_Tp, _Up> && + totally_ordered< + common_reference_t< + __make_const_lvalue_ref<_Tp>, + __make_const_lvalue_ref<_Up>>> && + __partially_ordered_with<_Tp, _Up>; +// clang-format on + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD |