diff --git a/stl/inc/concepts b/stl/inc/concepts index 7ba91673c..b7b43c2e2 100644 --- a/stl/inc/concepts +++ b/stl/inc/concepts @@ -100,11 +100,7 @@ template concept assignable_from = is_lvalue_reference_v<_LTy> && common_reference_with&, const remove_reference_t<_RTy>&> && requires(_LTy _Left, _RTy&& _Right) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { _Left = static_cast<_RTy&&>(_Right) } -> same_as<_LTy>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - _Left = static_cast<_RTy&&>(_Right); requires same_as<_LTy, decltype(_Left = static_cast<_RTy&&>(_Right))>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // swappable and swappable_with are defined below, since they depend on move_constructible. @@ -222,7 +218,6 @@ concept movable = is_object_v<_Ty> && move_constructible<_Ty> && assignable_from template concept _STL_BOOLEAN_CONCEPT = movable> && requires(const remove_reference_t<_Ty>& __x, const remove_reference_t<_Ty>& __y, const bool __b) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __x } -> convertible_to; { !__x } -> convertible_to; { __x && __y } -> same_as; @@ -237,39 +232,16 @@ concept _STL_BOOLEAN_CONCEPT = movable> { __x != __y } -> convertible_to; { __x != __b } -> convertible_to; { __b != __y } -> convertible_to; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - requires convertible_to&, bool>; - !__x; requires convertible_to; - __x && __y; requires same_as; - __x && __b; requires same_as; - __b && __y; requires same_as; - __x || __y; requires same_as; - __x || __b; requires same_as; - __b || __y; requires same_as; - __x == __y; requires convertible_to; - __x == __b; requires convertible_to; - __b == __y; requires convertible_to; - __x != __y; requires convertible_to; - __x != __b; requires convertible_to; - __b != __y; requires convertible_to; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT _Weakly_equality_comparable_with template concept _Weakly_equality_comparable_with = requires(const remove_reference_t<_Ty1>& __t, const remove_reference_t<_Ty2>& __u) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __t == __u } -> _STL_BOOLEAN_CONCEPT; { __t != __u } -> _STL_BOOLEAN_CONCEPT; { __u == __t } -> _STL_BOOLEAN_CONCEPT; { __u != __t } -> _STL_BOOLEAN_CONCEPT; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __t == __u; requires _STL_BOOLEAN_CONCEPT; - __t != __u; requires _STL_BOOLEAN_CONCEPT; - __u == __t; requires _STL_BOOLEAN_CONCEPT; - __u != __t; requires _STL_BOOLEAN_CONCEPT; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT equality_comparable @@ -287,17 +259,10 @@ concept equality_comparable_with = equality_comparable<_Ty1> && equality_compara template concept totally_ordered = equality_comparable<_Ty> && requires(const remove_reference_t<_Ty>& __x, const remove_reference_t<_Ty>& __y) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __x < __y } -> _STL_BOOLEAN_CONCEPT; { __x > __y } -> _STL_BOOLEAN_CONCEPT; { __x <= __y } -> _STL_BOOLEAN_CONCEPT; { __x >= __y } -> _STL_BOOLEAN_CONCEPT; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __x < __y; requires _STL_BOOLEAN_CONCEPT; - __x > __y; requires _STL_BOOLEAN_CONCEPT __y)>; - __x <= __y; requires _STL_BOOLEAN_CONCEPT; - __x >= __y; requires _STL_BOOLEAN_CONCEPT= __y)>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT totally_ordered_with @@ -307,7 +272,6 @@ concept totally_ordered_with = totally_ordered<_Ty1> && totally_ordered<_Ty2> && totally_ordered&, const remove_reference_t<_Ty2>&>> && equality_comparable_with<_Ty1, _Ty2> && requires(const remove_reference_t<_Ty1>& __t, const remove_reference_t<_Ty2>& __u) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __t < __u } -> _STL_BOOLEAN_CONCEPT; { __t > __u } -> _STL_BOOLEAN_CONCEPT; { __t <= __u } -> _STL_BOOLEAN_CONCEPT; @@ -316,16 +280,6 @@ concept totally_ordered_with = totally_ordered<_Ty1> && totally_ordered<_Ty2> { __u > __t } -> _STL_BOOLEAN_CONCEPT; { __u <= __t } -> _STL_BOOLEAN_CONCEPT; { __u >= __t } -> _STL_BOOLEAN_CONCEPT; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __t < __u; requires _STL_BOOLEAN_CONCEPT; - __t > __u; requires _STL_BOOLEAN_CONCEPT __u)>; - __t <= __u; requires _STL_BOOLEAN_CONCEPT; - __t >= __u; requires _STL_BOOLEAN_CONCEPT= __u)>; - __u < __t; requires _STL_BOOLEAN_CONCEPT; - __u > __t; requires _STL_BOOLEAN_CONCEPT __t)>; - __u <= __t; requires _STL_BOOLEAN_CONCEPT; - __u >= __t; requires _STL_BOOLEAN_CONCEPT= __t)>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT copyable diff --git a/stl/inc/random b/stl/inc/random index eaf42b519..8f9d87fed 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -62,13 +62,8 @@ struct _Require_constant; // not defined; _Require_constant is a valid type i // clang-format off template concept uniform_random_bit_generator = invocable<_Ty&> && unsigned_integral> && requires { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { (_Ty::min)() } -> same_as>; { (_Ty::max)() } -> same_as>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - (_Ty::min)(); requires same_as>; - (_Ty::max)(); requires same_as>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT #if 1 // Implement the PR for LWG-3150 typename _Require_constant<(_Ty::min)()>; typename _Require_constant<(_Ty::max)()>; diff --git a/stl/inc/xutility b/stl/inc/xutility index 1e5afbd1b..ef8683177 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -217,11 +217,7 @@ concept _Can_reference = requires { typename _With_reference<_Ty>; }; // CONCEPT _Dereferenceable template concept _Dereferenceable = requires(_Ty& __t) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { *__t } -> _Can_reference; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - *__t; requires _Can_reference; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // clang-format on @@ -290,11 +286,7 @@ struct incrementable_traits<_Ty> { // clang-format off template concept _Can_difference = requires(const _Ty& __a, const _Ty& __b) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __a - __b } -> integral; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __a - __b; requires integral; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; template @@ -405,15 +397,9 @@ struct _Iter_traits_difference { // clang-format off template concept _Cpp17_iterator = copyable<_It> && requires(_It __i) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { *__i } -> _Can_reference; { ++__i } -> same_as<_It&>; { *__i++ } -> _Can_reference; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - *__i; requires _Can_reference; - ++__i; requires same_as; - *__i++; requires _Can_reference; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; template @@ -491,21 +477,12 @@ struct _Iter_traits_category4 { template concept _Cpp17_random_delta = totally_ordered<_It> && requires(_It __i, typename incrementable_traits<_It>::difference_type __n) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __i += __n } -> same_as<_It&>; { __i -= __n } -> same_as<_It&>; { __i + __n } -> same_as<_It>; { __n + __i } -> same_as<_It>; { __i - __n } -> same_as<_It>; { __i - __i } -> same_as; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __i += __n; requires same_as; - __i -= __n; requires same_as; - __i + __n; requires same_as; - __n + __i; requires same_as; - __i - __n; requires same_as; - __i - __i; requires same_as; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT { __i[__n] } -> convertible_to>; }; // clang-format on @@ -525,11 +502,7 @@ struct _Iter_traits_category3 { // clang-format off template concept _Cpp17_bidi_delta = requires(_It __i) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { --__i } -> same_as<_It&>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - --__i; requires same_as; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT { __i-- } -> convertible_to; requires same_as>; }; @@ -675,11 +648,7 @@ namespace ranges { // clang-format off template requires _Dereferenceable<_Ty> && requires(_Ty& __t) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { _STD ranges::iter_move(__t) } -> _Can_reference; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - _STD ranges::iter_move(__t); requires _Can_reference; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT } using iter_rvalue_reference_t = decltype(_STD ranges::iter_move(_STD declval<_Ty&>())); @@ -713,32 +682,20 @@ template concept weakly_incrementable = default_initializable<_Ty> && movable<_Ty> && requires(_Ty __i) { typename iter_difference_t<_Ty>; requires signed_integral>; -#if _HAS_EXACT_COMPOUND_REQUIREMENT { ++__i } -> same_as<_Ty&>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - ++__i; requires same_as; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT __i++; }; // CONCEPT incrementable template concept incrementable = regular<_Ty> && weakly_incrementable<_Ty> && requires(_Ty __t) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __t++ } -> same_as<_Ty>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __t++; requires same_as; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT input_or_output_iterator template concept input_or_output_iterator = requires(_It __i) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { *__i } -> _Can_reference; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - *__i; requires _Can_reference; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT requires weakly_incrementable<_It>; }; @@ -756,13 +713,8 @@ inline constexpr bool disable_sized_sentinel = false; template concept sized_sentinel_for = sentinel_for<_Se, _It> && !disable_sized_sentinel, remove_cv_t<_It>> && requires(const _It& __i, const _Se& __s) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __s - __i } -> same_as>; { __i - __s } -> same_as>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __s - __i; requires same_as>; - __i - __s; requires same_as>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // clang-format on @@ -827,13 +779,8 @@ concept forward_iterator = input_iterator<_It> && derived_from<_Iter_concept<_It template concept bidirectional_iterator = forward_iterator<_It> && derived_from<_Iter_concept<_It>, bidirectional_iterator_tag> && requires(_It __i) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { --__i } -> same_as<_It&>; { __i-- } -> same_as<_It>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - --__i; requires same_as; - __i--; requires same_as; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT random_access_iterator @@ -841,21 +788,12 @@ template concept random_access_iterator = bidirectional_iterator<_It> && derived_from<_Iter_concept<_It>, random_access_iterator_tag> && totally_ordered<_It> && sized_sentinel_for<_It, _It> && requires(_It __i, const _It __j, const iter_difference_t<_It> __n) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { __i += __n } -> same_as<_It&>; { __j + __n } -> same_as<_It>; { __n + __j } -> same_as<_It>; { __i -= __n } -> same_as<_It&>; { __j - __n } -> same_as<_It>; { __j[__n] } -> same_as>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - __i += __n; requires same_as; - __j + __n; requires same_as; - __n + __j; requires same_as; - __i -= __n; requires same_as; - __j - __n; requires same_as; - __j[__n]; requires same_as>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT contiguous_iterator @@ -865,11 +803,7 @@ concept contiguous_iterator = random_access_iterator<_It> && is_lvalue_reference_v> && same_as, remove_cvref_t>> && requires(const _It& __i) { -#if _HAS_EXACT_COMPOUND_REQUIREMENT { _STD to_address(__i) } -> same_as>>; -#else // ^^^ _HAS_EXACT_COMPOUND_REQUIREMENT / !_HAS_EXACT_COMPOUND_REQUIREMENT vvv - _STD to_address(__i); requires same_as>>; -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT }; // CONCEPT indirectly_movable diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 3f92bc6fc..9412cc07a 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -953,15 +953,6 @@ #if defined(__cpp_concepts) && __cpp_concepts > 201507L #define __cpp_lib_concepts 201907L -// "Detect" P1084's exact-type-and-value-category semantics for trailing-return-types in compound requirements -#ifndef _HAS_EXACT_COMPOUND_REQUIREMENT -#if __cpp_concepts >= 201811L -#define _HAS_EXACT_COMPOUND_REQUIREMENT 1 -#else // ^^^ post-P1084 concepts / pre-P1084 concepts vvv -#define _HAS_EXACT_COMPOUND_REQUIREMENT 0 -#endif // __cpp_concepts >= 201811L -#endif // _HAS_EXACT_COMPOUND_REQUIREMENT - // P0898R3 (as modified by P1754R1) std::boolean #ifndef _HAS_STD_BOOLEAN #define _HAS_STD_BOOLEAN 1