From 5e05034a12d2a527038e3245ede2a7dccfd1a954 Mon Sep 17 00:00:00 2001 From: cpplearner Date: Wed, 3 Jan 2024 20:24:17 +0800 Subject: [PATCH] [Mechanical] Replace uses of `__cpp_lib_concepts` The following substitutions are performed: - `#elif _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#elif _HAS_CXX20` - `#elif defined(__cpp_lib_concepts)` => `#elif _HAS_CXX20` - `#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv` => `#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv` - `#else // ^^^ _HAS_CXX20 && !defined(__cpp_lib_concepts) / !_HAS_CXX20 vvv` => `#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv` - `#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv` => `#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv` - `#endif // !_HAS_CXX20 || !defined(__cpp_lib_concepts)` => `#endif // !_HAS_CXX20` - `#endif // ^^^ !defined(__cpp_lib_concepts) ^^^` => `#endif // ^^^ !_HAS_CXX20 ^^^` - `#endif // ^^^ defined(__cpp_lib_concepts) ^^^` => `#endif // ^^^ _HAS_CXX20 ^^^` - `#endif // _HAS_CXX20 && defined(__cpp_lib_concepts)` => `#endif // _HAS_CXX20` - `#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)` => `#endif // _HAS_CXX23` - `#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#endif // _HAS_CXX23` - `#endif // __cpp_lib_concepts` => `#endif // _HAS_CXX20` - `#endif // defined(__cpp_lib_concepts)` => `#endif // _HAS_CXX20` - `#endif // defined(__cpp_lib_concepts) && _HAS_CXX23` => `#endif // _HAS_CXX23` - `#if !_HAS_CXX20 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#if !_HAS_CXX20` - `#if !_HAS_CXX23 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#if !_HAS_CXX23` - `#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#if _HAS_CXX20` - `#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#if _HAS_CXX23` - `#if _HAS_CXX23 && defined(__cpp_lib_concepts)` => `#if _HAS_CXX23` - `#if defined(__cpp_lib_concepts) && _HAS_CXX23` => `#if _HAS_CXX23` - `#if defined(__cpp_lib_concepts) // TRANSITION, GH-395` => `#if _HAS_CXX20` - `#if defined(__cpp_lib_concepts)` => `#if _HAS_CXX20` - `#ifdef __cpp_lib_concepts // TRANSITION, GH-395` => `#if _HAS_CXX20` - `#ifdef __cpp_lib_concepts` => `#if _HAS_CXX20` - `#ifndef __cpp_lib_concepts` => `#if !_HAS_CXX20` --- stl/inc/__msvc_chrono.hpp | 8 +- stl/inc/__msvc_formatter.hpp | 4 +- stl/inc/__msvc_int128.hpp | 8 +- stl/inc/__msvc_iter_core.hpp | 6 +- stl/inc/__msvc_print.hpp | 2 +- stl/inc/algorithm | 230 +++++++++--------- stl/inc/array | 14 +- stl/inc/chrono | 26 +- stl/inc/compare | 10 +- stl/inc/concepts | 6 +- stl/inc/coroutine | 2 +- stl/inc/deque | 26 +- stl/inc/expected | 2 +- stl/inc/filesystem | 12 +- stl/inc/format | 6 +- stl/inc/forward_list | 26 +- stl/inc/functional | 30 +-- stl/inc/iterator | 48 ++-- stl/inc/list | 30 +-- stl/inc/map | 28 +-- stl/inc/mdspan | 2 +- stl/inc/memory | 62 ++--- stl/inc/numbers | 12 +- stl/inc/numeric | 4 +- stl/inc/optional | 36 +-- stl/inc/queue | 40 +-- stl/inc/regex | 8 +- stl/inc/set | 28 +-- stl/inc/span | 34 +-- stl/inc/spanstream | 12 +- stl/inc/stack | 24 +- stl/inc/stacktrace | 14 +- stl/inc/system_error | 24 +- stl/inc/thread | 8 +- stl/inc/tuple | 72 +++--- stl/inc/type_traits | 4 +- stl/inc/unordered_map | 16 +- stl/inc/unordered_set | 16 +- stl/inc/utility | 28 +-- stl/inc/variant | 4 +- stl/inc/vector | 90 +++---- stl/inc/xhash | 4 +- stl/inc/xmemory | 28 +-- stl/inc/xstring | 48 ++-- stl/inc/xtree | 4 +- stl/inc/xutility | 230 +++++++++--------- .../include/test_min_max_element_support.hpp | 6 +- .../test.cpp | 8 +- .../test.cpp | 4 +- .../test.cpp | 20 +- .../tests/GH_000431_copy_move_family/test.cpp | 4 +- .../std/tests/GH_000431_equal_family/test.cpp | 6 +- .../test.compile.pass.cpp | 12 +- .../test.compile.pass.cpp | 8 +- .../GH_000431_lex_compare_family/test.cpp | 12 +- .../test.compile.pass.cpp | 32 +-- .../GH_000545_include_compare/test_ranges.cpp | 4 +- .../std/tests/GH_001411_core_headers/test.cpp | 4 +- .../test.compile.pass.cpp | 16 +- .../test.cpp | 4 +- .../GH_002989_nothrow_unwrappable/test.cpp | 4 +- .../test.cpp | 8 +- tests/std/tests/P0122R7_span/test.cpp | 24 +- tests/std/tests/P0220R1_optional/test.cpp | 6 +- tests/std/tests/P0220R1_string_view/test.cpp | 8 +- .../test.cpp | 4 +- .../test.cpp | 8 +- .../tests/P0401R6_allocate_at_least/test.cpp | 34 +-- .../tests/P0433R2_deduction_guides/test.cpp | 40 +-- tests/std/tests/P0448R4_spanstream/test.cpp | 8 +- .../test.cpp | 4 +- .../tests/P0768R1_spaceship_operator/test.cpp | 8 +- .../tests/P0784R7_library_machinery/test.cpp | 4 +- .../test.cpp | 40 +-- .../test.cpp | 4 +- tests/std/tests/P0881R7_stacktrace/test.cpp | 4 +- .../tests/P0896R4_stream_iterators/test.cpp | 32 +-- .../tests/P0980R1_constexpr_strings/test.cpp | 6 +- .../tests/P1522R1_difference_type/test.cpp | 24 +- .../tests/P2321R2_proxy_reference/test.cpp | 8 +- .../tests/VSO_0000000_type_traits/test.cpp | 4 +- .../VSO_0000000_vector_algorithms/test.cpp | 36 +-- .../test.compile.pass.cpp | 76 +++--- 83 files changed, 955 insertions(+), 955 deletions(-) diff --git a/stl/inc/__msvc_chrono.hpp b/stl/inc/__msvc_chrono.hpp index 265522d305..8da26708e5 100644 --- a/stl/inc/__msvc_chrono.hpp +++ b/stl/inc/__msvc_chrono.hpp @@ -405,7 +405,7 @@ namespace chrono { return !(_Left < _Right); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template requires three_way_comparable, duration<_Rep2, _Period2>>::rep> _NODISCARD constexpr auto operator<=>(const duration<_Rep1, _Period1>& _Left, @@ -414,7 +414,7 @@ namespace chrono { using _CT = common_type_t, duration<_Rep2, _Period2>>; return _CT(_Left).count() <=> _CT(_Right).count(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template , int> /* = 0 */> _NODISCARD constexpr _To duration_cast(const duration<_Rep, _Period>& _Dur) noexcept( @@ -593,14 +593,14 @@ namespace chrono { return !(_Left < _Right); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _Duration2> _NODISCARD constexpr auto operator<=>(const time_point<_Clock, _Duration1>& _Left, const time_point<_Clock, _Duration2>& _Right) noexcept( is_arithmetic_v && is_arithmetic_v) /* strengthened */ { return _Left.time_since_epoch() <=> _Right.time_since_epoch(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template , int> = 0> _NODISCARD constexpr time_point<_Clock, _To> time_point_cast(const time_point<_Clock, _Duration>& _Time) noexcept( diff --git a/stl/inc/__msvc_formatter.hpp b/stl/inc/__msvc_formatter.hpp index afba40829b..5d4232d99e 100644 --- a/stl/inc/__msvc_formatter.hpp +++ b/stl/inc/__msvc_formatter.hpp @@ -39,9 +39,9 @@ #include #if _STL_COMPILER_PREPROCESSOR -#if !_HAS_CXX20 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if !_HAS_CXX20 #error The contents of are only available with C++20. (Also, you should not include this internal header.) -#endif // !_HAS_CXX20 || !defined(__cpp_lib_concepts) +#endif // !_HAS_CXX20 #include #include diff --git a/stl/inc/__msvc_int128.hpp b/stl/inc/__msvc_int128.hpp index 146f2f85cb..c24f110564 100644 --- a/stl/inc/__msvc_int128.hpp +++ b/stl/inc/__msvc_int128.hpp @@ -23,12 +23,12 @@ {} // Trivial default initialization is not allowed in constexpr functions before C++20. #endif // ^^^ !_HAS_CXX20 ^^^ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include #define _TEMPLATE_CLASS_INTEGRAL(type) template -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv #define _TEMPLATE_CLASS_INTEGRAL(type) template , int> = 0> -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -308,7 +308,7 @@ struct _TEMPLATE_CLASS_INTEGRAL(_Ty) constexpr _Base128(const _Ty _Val) noexcept : _Word{static_cast(_Val)} { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 if constexpr (signed_integral<_Ty>) #else if constexpr (is_signed_v<_Ty>) diff --git a/stl/inc/__msvc_iter_core.hpp b/stl/inc/__msvc_iter_core.hpp index b3dc4d2c28..186e526fe9 100644 --- a/stl/inc/__msvc_iter_core.hpp +++ b/stl/inc/__msvc_iter_core.hpp @@ -47,7 +47,7 @@ _EXPORT_STD struct bidirectional_iterator_tag : forward_iterator_tag {}; _EXPORT_STD struct random_access_iterator_tag : bidirectional_iterator_tag {}; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD struct contiguous_iterator_tag : random_access_iterator_tag {}; template @@ -482,7 +482,7 @@ template struct tuple_element<1, const ranges::subrange<_It, _Se, _Ki>> { using type = _Se; }; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template struct _Iterator_traits_base {}; // empty for non-iterators @@ -515,7 +515,7 @@ struct iterator_traits : _Iterator_traits_base<_Iter> {}; // get traits from ite template struct iterator_traits<_Ty*> : _Iterator_traits_pointer_base<_Ty> {}; // get traits from pointer, if possible -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _STD_END #pragma pop_macro("new") diff --git a/stl/inc/__msvc_print.hpp b/stl/inc/__msvc_print.hpp index ef02ef726c..e991788acf 100644 --- a/stl/inc/__msvc_print.hpp +++ b/stl/inc/__msvc_print.hpp @@ -10,7 +10,7 @@ #ifndef __cpp_lib_concepts // note: includes this header in C++20 mode #error The contents of are available only with C++23. (Also, you should not include this internal header.) -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #include #include diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 95900a911b..c859fa8f14 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -169,7 +169,7 @@ struct _Optimistic_temporary_buffer { // temporary storage with _alloca-like att _Aligned_storage_t _Stack_space[_Optimistic_count]; }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template struct in_fun_result { @@ -275,7 +275,7 @@ namespace ranges { }; #endif // _HAS_CXX23 } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _Fn for_each(_InIt _First, _InIt _Last, _Fn _Func) { // perform function for each element [_First, _Last) @@ -315,7 +315,7 @@ _EXPORT_STD template using for_each_result = in_fun_result<_In, _Fun>; @@ -390,7 +390,7 @@ namespace ranges { _EXPORT_STD inline constexpr _For_each_n_fn for_each_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_CXX17 _EXPORT_STD template = 0> @@ -453,7 +453,7 @@ _NODISCARD _FwdIt adjacent_find(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Count_fn { public: @@ -509,7 +509,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Count_fn count; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _Iter_diff_t<_InIt> count_if(_InIt _First, _InIt _Last, _Pr _Pred) { @@ -532,7 +532,7 @@ _EXPORT_STD template count_if(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, _Pr _Pred) noexcept; // terminates #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Count_if_fn { public: @@ -571,7 +571,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Count_if_fn count_if; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 pair<_InIt1, _InIt2> mismatch(_InIt1 _First1, const _InIt1 _Last1, _InIt2 _First2, _Pr _Pred) { @@ -664,7 +664,7 @@ _NODISCARD pair<_FwdIt1, _FwdIt2> mismatch( } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -761,7 +761,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Equal_fn equal; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool is_permutation(_FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Pr _Pred) { @@ -857,7 +857,7 @@ _NODISCARD _CONSTEXPR20 bool is_permutation(_FwdIt1 _First1, _FwdIt1 _Last1, _Fw return _STD is_permutation(_First1, _Last1, _First2, _Last2, equal_to<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Is_permutation_fn { public: @@ -1128,7 +1128,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Is_permutation_fn is_permutation; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool all_of(_InIt _First, _InIt _Last, _Pr _Pred) { // test if all elements satisfy _Pred @@ -1149,7 +1149,7 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool any_of(const _InIt _First, const _InIt _Last, _Pr _Pred) { @@ -1209,7 +1209,7 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool none_of(const _InIt _First, const _InIt _Last, _Pr _Pred) { @@ -1269,7 +1269,7 @@ _EXPORT_STD template _CONSTEXPR20 _OutIt copy_if(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pred) { // copy each satisfying _Pred @@ -1454,7 +1454,7 @@ _FwdIt2 copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _Pr _Pred } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using copy_if_result = in_out_result<_In, _Out>; @@ -1599,7 +1599,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Move_backward_fn move_backward; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 pair<_OutIt1, _OutIt2> partition_copy( @@ -1638,7 +1638,7 @@ pair<_FwdIt2, _FwdIt3> partition_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _F return _STD partition_copy(_First, _Last, _Dest_true, _Dest_false, _Pass_fn(_Pred)); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using partition_copy_result = in_out_out_result<_In, _Out1, _Out2>; @@ -1702,7 +1702,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partition_copy_fn partition_copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -1736,7 +1736,7 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt partition_point(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { @@ -1810,7 +1810,7 @@ _NODISCARD _CONSTEXPR20 _FwdIt partition_point(_FwdIt _First, _FwdIt _Last, _Pr return _First; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Partition_point_fn { public: @@ -1904,7 +1904,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partition_point_fn partition_point; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _NODISCARD _CONSTEXPR20 bool _Equal_rev_pred_unchecked(_InIt1 _First1, _InIt2 _First2, const _InIt2 _Last2, _Pr _Pred) { @@ -2094,7 +2094,7 @@ _NODISCARD _FwdIt search_n(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Las } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Search_n_fn { public: @@ -2950,7 +2950,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Find_last_if_fn find_last_if_not; #endif // _HAS_CXX23 } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt1 find_end( @@ -3052,7 +3052,7 @@ _NODISCARD _FwdIt1 find_end(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _Fwd } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Find_end_fn { private: @@ -3212,7 +3212,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Find_end_fn find_end; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt1 find_first_of( @@ -3255,7 +3255,7 @@ _NODISCARD _FwdIt1 find_first_of(_ExPo&& _Exec, const _FwdIt1 _First1, const _Fw } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Find_first_of_fn { public: @@ -3405,7 +3405,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Swap_ranges_fn swap_ranges; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _FwdIt2 swap_ranges(const _FwdIt1 _First1, const _FwdIt1 _Last1, _FwdIt2 _First2) { @@ -3480,7 +3480,7 @@ _FwdIt3 transform(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First _Fn _Func) noexcept; // terminates #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using unary_transform_result = in_out_result<_In, _Out>; @@ -3585,7 +3585,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Transform_fn transform; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 void replace(const _FwdIt _First, const _FwdIt _Last, const _Ty& _Oldval, const _Ty& _Newval) { @@ -3606,7 +3606,7 @@ void replace(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, const _Ty& _Oldval, const _Ty& _Newval) noexcept; // terminates #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Replace_fn { public: @@ -3658,7 +3658,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Replace_fn replace; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 void replace_if(const _FwdIt _First, const _FwdIt _Last, _Pr _Pred, const _Ty& _Val) { @@ -3678,7 +3678,7 @@ _EXPORT_STD template _CONSTEXPR20 _OutIt replace_copy(_InIt _First, _InIt _Last, _OutIt _Dest, const _Ty& _Oldval, const _Ty& _Newval) { @@ -3762,7 +3762,7 @@ _FwdIt2 replace_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, cons } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using replace_copy_result = in_out_result<_In, _Out>; @@ -3821,7 +3821,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Replace_copy_fn replace_copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _OutIt replace_copy_if(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pred, const _Ty& _Val) { @@ -3855,7 +3855,7 @@ _FwdIt2 replace_copy_if(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _ } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using replace_copy_if_result = in_out_result<_In, _Out>; @@ -4016,7 +4016,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Generate_n_fn generate_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 void generate(_FwdIt _First, _FwdIt _Last, _Fn _Func) { // replace [_First, _Last) with _Func() @@ -4130,7 +4130,7 @@ _EXPORT_STD template _NODISCARD_UNIQUE_ALG _CONSTEXPR20 _FwdIt unique(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { @@ -4400,7 +4400,7 @@ _NODISCARD_UNIQUE_ALG _FwdIt unique(_ExPo&&, _FwdIt _First, _FwdIt _Last) noexce } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Unique_fn { public: @@ -4463,10 +4463,10 @@ namespace ranges { _EXPORT_STD inline constexpr _Unique_fn unique; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 concept #else _INLINE_VAR constexpr bool @@ -4554,7 +4554,7 @@ _FwdIt2 unique_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest) noexc } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using unique_copy_result = in_out_result<_In, _Out>; @@ -4717,7 +4717,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Reverse_fn reverse; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _OutIt reverse_copy(_BidIt _First, _BidIt _Last, _OutIt _Dest) { @@ -4775,7 +4775,7 @@ _FwdIt reverse_copy(_ExPo&&, _BidIt _First, _BidIt _Last, _FwdIt _Dest) noexcept return _STD reverse_copy(_First, _Last, _Dest); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using reverse_copy_result = in_out_result<_In, _Out>; @@ -4853,10 +4853,10 @@ namespace ranges { _EXPORT_STD inline constexpr _Reverse_copy_fn reverse_copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _NODISCARD constexpr subrange<_It> _Reverse_until_mid_unchecked(_It _First, const _It _Mid, _It _Last) { @@ -4961,7 +4961,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Rotate_fn rotate; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _OutIt rotate_copy(_FwdIt _First, _FwdIt _Mid, _FwdIt _Last, _OutIt _Dest) { @@ -4987,7 +4987,7 @@ _FwdIt2 rotate_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Mid, _FwdIt1 _Last, _FwdIt return _STD rotate_copy(_First, _Mid, _Last, _Dest); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using rotate_copy_result = in_out_result<_In, _Out>; @@ -5036,7 +5036,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Rotate_copy_fn rotate_copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -5185,7 +5185,7 @@ _SampleIt sample(_PopIt _First, _PopIt _Last, _SampleIt _Dest, _Diff _Count, _Ur return _Dest; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template concept uniform_random_bit_generator = invocable<_Ty&> && unsigned_integral> && requires { { (_Ty::min)() } -> same_as>; @@ -5292,7 +5292,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Sample_fn sample; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -5324,7 +5324,7 @@ void shuffle(_RanIt _First, _RanIt _Last, _Urng&& _Func) { // shuffle [_First, _ _Random_shuffle1(_First, _Last, _RngFunc); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Shuffle_fn { public: @@ -5378,7 +5378,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Shuffle_fn shuffle; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_AUTO_PTR_ETC _EXPORT_STD template @@ -5540,7 +5540,7 @@ _FwdIt shift_right(_ExPo&&, _FwdIt _First, _FwdIt _Last, } #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 namespace ranges { class _Shift_left_fn { public: @@ -5762,7 +5762,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Shift_right_fn shift_right; } // namespace ranges -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _EXPORT_STD template _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) { @@ -5826,7 +5826,7 @@ _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) { _EXPORT_STD template = 0> _FwdIt partition(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, _Pr _Pred) noexcept; // terminates -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Partition_fn { public: @@ -5904,7 +5904,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partition_fn partition; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -6077,7 +6077,7 @@ _BidIt stable_partition(_ExPo&&, _BidIt _First, _BidIt _Last, _Pr _Pred) noexcep } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _It _Buffered_rotate_common(const _It _First, const _It _Mid, const _It _Last, const iter_difference_t<_It> _Count1, @@ -6272,7 +6272,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Stable_partition_fn stable_partition; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _CONSTEXPR20 void _Push_heap_by_index( @@ -6309,7 +6309,7 @@ _CONSTEXPR20 void push_heap(_RanIt _First, _RanIt _Last) { _STD push_heap(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires sortable<_It, _Pr, _Pj1> && indirectly_writable<_It, _Ty> @@ -6377,7 +6377,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Push_heap_fn push_heap; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _CONSTEXPR20 void _Pop_heap_hole_by_index( @@ -6443,7 +6443,7 @@ _CONSTEXPR20 void pop_heap(_RanIt _First, _RanIt _Last) { _STD pop_heap(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires sortable<_It, _Pr, _Pj1> && indirectly_writable<_It, _Ty> @@ -6537,7 +6537,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Pop_heap_fn pop_heap; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _CONSTEXPR20 void _Make_heap_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) { @@ -6563,7 +6563,7 @@ _CONSTEXPR20 void make_heap(_RanIt _First, _RanIt _Last) { // make [_First, _Las _STD make_heap(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires sortable<_It, _Pr, _Pj> @@ -6609,7 +6609,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Make_heap_fn make_heap; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _CONSTEXPR20 _RanIt _Is_heap_until_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) { @@ -6676,7 +6676,7 @@ _NODISCARD bool is_heap(_ExPo&& _Exec, _RanIt _First, _RanIt _Last) noexcept /* return _STD is_heap(_STD forward<_ExPo>(_Exec), _First, _Last, less{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _NODISCARD constexpr _It _Is_heap_until_unchecked( @@ -6753,7 +6753,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Is_heap_until_fn is_heap_until; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -6783,7 +6783,7 @@ _CONSTEXPR20 void sort_heap(_RanIt _First, _RanIt _Last) { // order heap by repe _STD sort_heap(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires sortable<_It, _Pr, _Pj> @@ -6925,7 +6925,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Upper_bound_fn upper_bound; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 pair<_FwdIt, _FwdIt> equal_range(_FwdIt _First, _FwdIt _Last, const _Ty& _Val, _Pr _Pred) { @@ -6970,7 +6970,7 @@ _NODISCARD _CONSTEXPR20 pair<_FwdIt, _FwdIt> equal_range(_FwdIt _First, _FwdIt _ return _STD equal_range(_First, _Last, _Val, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Equal_range_fn { public: @@ -7029,7 +7029,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Equal_range_fn equal_range; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool binary_search(_FwdIt _First, _FwdIt _Last, const _Ty& _Val, _Pr _Pred) { @@ -7047,7 +7047,7 @@ _NODISCARD _CONSTEXPR20 bool binary_search(_FwdIt _First, _FwdIt _Last, const _T return _STD binary_search(_First, _Last, _Val, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Binary_search_fn { public: @@ -7076,7 +7076,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Binary_search_fn binary_search; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _NODISCARD constexpr _Distance_unknown _Idl_dist_add(_Distance_unknown, _Distance_unknown) { return {}; @@ -7169,7 +7169,7 @@ _FwdIt3 merge(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 return _STD merge(_First1, _Last1, _First2, _Last2, _Dest); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using merge_result = in_in_out_result<_In1, _In2, _Out>; @@ -7244,7 +7244,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Merge_fn merge; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 // The "usual invariants" for the inplace_merge helpers below are: @@ -7513,7 +7513,7 @@ void inplace_merge(_ExPo&&, _BidIt _First, _BidIt _Mid, _BidIt _Last) noexcept / } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _Se, class _Pr, class _Pj> requires indirect_strict_weak_order<_Pr, projected<_It, _Pj>> @@ -7831,7 +7831,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Inplace_merge_fn inplace_merge; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _CONSTEXPR20 _BidIt _Insertion_sort_unchecked(const _BidIt _First, const _BidIt _Last, _Pr _Pred) { @@ -8015,7 +8015,7 @@ void sort(_ExPo&& _Exec, const _RanIt _First, const _RanIt _Last) noexcept /* te } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires sortable<_It, _Pr, _Pj> @@ -8227,7 +8227,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Sort_fn sort; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _Ty* _Uninitialized_merge_move(_FwdIt _First, const _FwdIt _Mid, const _FwdIt _Last, _Ty* const _Dest, _Pr _Pred) { @@ -8422,7 +8422,7 @@ void stable_sort(_ExPo&& _Exec, _BidIt _First, _BidIt _Last) noexcept /* termina } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Stable_sort_fn { public: @@ -8671,7 +8671,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Stable_sort_fn stable_sort; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 void partial_sort(_RanIt _First, _RanIt _Mid, _RanIt _Last, _Pr _Pred) { @@ -8720,7 +8720,7 @@ void partial_sort(_ExPo&&, _RanIt _First, _RanIt _Mid, _RanIt _Last) noexcept /* return _STD partial_sort(_First, _Mid, _Last); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Partial_sort_fn { public: @@ -8790,7 +8790,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partial_sort_fn partial_sort; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -8852,7 +8852,7 @@ _RanIt partial_sort_copy(_ExPo&&, _FwdIt _First1, _FwdIt _Last1, _RanIt _First2, return _STD partial_sort_copy(_First1, _Last1, _First2, _Last2); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using partial_sort_copy_result = in_out_result<_In, _Out>; @@ -8936,7 +8936,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partial_sort_copy_fn partial_sort_copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -8988,7 +8988,7 @@ void nth_element(_ExPo&&, _RanIt _First, _RanIt _Nth, _RanIt _Last) noexcept /* _STD nth_element(_First, _Nth, _Last); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Nth_element_fn { public: @@ -9058,7 +9058,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Nth_element_fn nth_element; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -9112,7 +9112,7 @@ _NODISCARD bool includes(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _Firs return _STD includes(_First1, _Last1, _First2, _Last2); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Includes_fn { public: @@ -9180,7 +9180,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Includes_fn includes; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -9245,7 +9245,7 @@ _FwdIt3 set_union(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Fw return _STD set_union(_First1, _Last1, _First2, _Last2, _Dest); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using set_union_result = in_in_out_result<_In1, _In2, _Out>; @@ -9317,7 +9317,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Set_union_fn set_union; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -9370,7 +9370,7 @@ _FwdIt3 set_intersection(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 return _STD set_intersection(_STD forward<_ExPo>(_Exec), _First1, _Last1, _First2, _Last2, _Dest, less{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using set_intersection_result = in_in_out_result<_In1, _In2, _Out>; @@ -9448,7 +9448,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Set_intersection_fn set_intersection; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -9502,7 +9502,7 @@ _FwdIt3 set_difference(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _ return _STD set_difference(_STD forward<_ExPo>(_Exec), _First1, _Last1, _First2, _Last2, _Dest, less{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using set_difference_result = in_out_result<_In, _Out>; @@ -9576,7 +9576,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Set_difference_fn set_difference; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -9644,7 +9644,7 @@ _FwdIt3 set_symmetric_difference(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdI return _STD set_symmetric_difference(_First1, _Last1, _First2, _Last2, _Dest); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using set_symmetric_difference_result = in_in_out_result<_In1, _In2, _Out>; @@ -9726,7 +9726,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Set_symmetric_difference_fn set_symmetric_difference; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -9818,7 +9818,7 @@ _NODISCARD pair<_FwdIt, _FwdIt> minmax_element(_ExPo&&, _FwdIt _First, _FwdIt _L return _STD minmax_element(_First, _Last); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using minmax_element_result = min_max_result<_Ty>; @@ -9917,7 +9917,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Minmax_element_fn minmax_element; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -9958,7 +9958,7 @@ _NODISCARD constexpr pair<_Ty, _Ty> minmax(initializer_list<_Ty> _Ilist) { return _STD minmax(_Ilist, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using minmax_result = min_max_result<_Ty>; @@ -10118,7 +10118,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Minmax_fn minmax; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 bool next_permutation(_BidIt _First, _BidIt _Last, _Pr _Pred) { @@ -10157,7 +10157,7 @@ _CONSTEXPR20 bool next_permutation(_BidIt _First, _BidIt _Last) { return _STD next_permutation(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using next_permutation_result = in_found_result<_In>; @@ -10220,7 +10220,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Next_permutation_fn next_permutation; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 bool prev_permutation(_BidIt _First, _BidIt _Last, _Pr _Pred) { @@ -10259,7 +10259,7 @@ _CONSTEXPR20 bool prev_permutation(_BidIt _First, _BidIt _Last) { return _STD prev_permutation(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using prev_permutation_result = in_found_result<_In>; @@ -10322,7 +10322,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Prev_permutation_fn prev_permutation; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt is_sorted_until(const _FwdIt _First, _FwdIt _Last, _Pr _Pred) { @@ -10385,7 +10385,7 @@ _NODISCARD bool is_sorted(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last) noexcept / return _STD is_sorted(_STD forward<_ExPo>(_Exec), _First, _Last, less{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Is_sorted_fn { public: @@ -10434,7 +10434,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Is_sorted_until_fn is_sorted_until; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr const _Ty& clamp(const _Ty& _Val, const _Ty& _Min_val, const _Ty& _Max_val, _Pr _Pred) { @@ -10469,7 +10469,7 @@ _NODISCARD constexpr const _Ty& clamp(const _Ty& _Val, const _Ty& _Min_val, cons return _STD clamp(_Val, _Min_val, _Max_val, less{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Clamp_fn { public: @@ -10574,7 +10574,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Lexicographical_compare_fn lexicographical_compare; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 #undef _REQUIRE_BIDIRECTIONAL_ITERATOR diff --git a/stl/inc/array b/stl/inc/array index cdc0267dc7..a659045a59 100644 --- a/stl/inc/array +++ b/stl/inc/array @@ -31,9 +31,9 @@ class _Array_const_iterator #endif // _ITERATOR_DEBUG_LEVEL != 0 { public: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = _Ty; using difference_type = ptrdiff_t; @@ -304,9 +304,9 @@ class _Array_iterator : public _Array_const_iterator<_Ty, _Size> { public: using _Mybase = _Array_const_iterator<_Ty, _Size>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = _Ty; using difference_type = ptrdiff_t; @@ -785,14 +785,14 @@ _NODISCARD bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Siz } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr _Synth_three_way_result<_Ty> operator<=>( const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { return _STD lexicographical_compare_three_way( _Left.data(), _Left.data() + _Size, _Right.data(), _Right.data() + _Size, _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD _CONSTEXPR20 bool operator<(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { return _STD lexicographical_compare(_Left.data(), _Left.data() + _Size, _Right.data(), _Right.data() + _Size); @@ -812,7 +812,7 @@ template _NODISCARD _CONSTEXPR20 bool operator>=(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if _HAS_CXX20 template diff --git a/stl/inc/chrono b/stl/inc/chrono index 34f10386d0..da3eca58a7 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -31,11 +31,11 @@ #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include #include #include -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX20 #pragma pack(push, _CRT_PACKING) @@ -1699,7 +1699,7 @@ namespace chrono { : runtime_error(_Make_string(_Tp, _Info)) {} private: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _NODISCARD static string _Make_string(const local_time<_Duration>& _Tp, const local_info& _Info); #else // ^^^ no workaround / workaround vvv @@ -1722,7 +1722,7 @@ namespace chrono { : runtime_error(_Make_string(_Tp, _Info)) {} private: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _NODISCARD static string _Make_string(const local_time<_Duration>& _Tp, const local_info& _Info); #else // ^^^ no workaround / workaround vvv @@ -1927,12 +1927,12 @@ namespace chrono { return _Left.name() == _Right.name(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD _NODISCARD inline strong_ordering operator<=>( const time_zone& _Left, const time_zone& _Right) noexcept { return _Left.name() <=> _Right.name(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 // [time.zone.leap] @@ -2013,7 +2013,7 @@ namespace chrono { return !(_Left < _Right.date()); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template requires three_way_comparable_with> _NODISCARD constexpr auto operator<=>(const leap_second& _Left, const sys_time<_Duration>& _Right) noexcept { @@ -2023,7 +2023,7 @@ namespace chrono { const leap_second& _Left, const leap_second& _Right) noexcept { return _Left.date() <=> _Right.date(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 // [time.zone.link] @@ -2056,12 +2056,12 @@ namespace chrono { return _Left.name() == _Right.name(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD _NODISCARD inline strong_ordering operator<=>( const time_zone_link& _Left, const time_zone_link& _Right) noexcept { return _Left.name() <=> _Right.name(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 // [time.zone.db] @@ -2648,7 +2648,7 @@ namespace chrono { // Convert to the last leap second before or equal to _Time. const auto& _Last_leap = *--_It; const utc_seconds _Utc_leap_second{_Last_leap.date().time_since_epoch() + _It->_Elapsed() - seconds{1}}; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 const auto _Leap_cmp = _Utc_leap_second <=> _Time_floor; #else // ^^^ __cpp_lib_concepts / TRANSITION, GH-395 workaround vvv const auto _Leap_cmp = _Utc_leap_second > _Time_floor ? strong_ordering::greater @@ -4693,7 +4693,7 @@ namespace chrono { } } // namespace chrono -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // [time.format] // clang-format off @@ -6006,7 +6006,7 @@ namespace chrono { return _STD move(_Os).str(); } } // namespace chrono -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 inline namespace literals { inline namespace chrono_literals { diff --git a/stl/inc/compare b/stl/inc/compare index e35d1a3a4d..4a8b13eafd 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -11,11 +11,11 @@ #if !_HAS_CXX20 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); #else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv #include -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -295,7 +295,7 @@ struct common_comparison_category { using type = common_comparison_category_t<_Types...>; }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template concept _Compares_as = same_as, _Cat>; @@ -843,7 +843,7 @@ inline namespace _Cpos { _EXPORT_STD inline constexpr _Compare_partial_order_fallback::_Cpo compare_partial_order_fallback; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _STD_END #pragma pop_macro("new") diff --git a/stl/inc/concepts b/stl/inc/concepts index c377e117b1..63c34d719e 100644 --- a/stl/inc/concepts +++ b/stl/inc/concepts @@ -8,9 +8,9 @@ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_concepts +#if !_HAS_CXX20 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 concepts support."); -#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv +#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv #include #include @@ -296,6 +296,6 @@ _STD_END _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _STL_COMPILER_PREPROCESSOR #endif // _CONCEPTS_ diff --git a/stl/inc/coroutine b/stl/inc/coroutine index 17c04ae103..daef64c137 100644 --- a/stl/inc/coroutine +++ b/stl/inc/coroutine @@ -160,7 +160,7 @@ _EXPORT_STD _NODISCARD constexpr bool operator==( #if _HAS_CXX20 _EXPORT_STD _NODISCARD constexpr strong_ordering operator<=>( const coroutine_handle<> _Left, const coroutine_handle<> _Right) noexcept { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 return compare_three_way{}(_Left.address(), _Right.address()); #else // ^^^ no workaround / workaround vvv return _Left.address() <=> _Right.address(); diff --git a/stl/inc/deque b/stl/inc/deque index a5a97e287c..b9234dcf62 100644 --- a/stl/inc/deque +++ b/stl/inc/deque @@ -668,7 +668,7 @@ public: _Construct(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> deque(from_range_t, _Rng&& _Range) : _Mypair(_Zero_then_variadic_args_t{}) { _Construct(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -678,7 +678,7 @@ public: deque(from_range_t, _Rng&& _Range, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 deque(const deque& _Right) : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { @@ -829,12 +829,12 @@ public: _Assign_range(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void assign_range(_Rng&& _Range) { _Assign_range(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void assign(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) { // assign _Count * _Val _Orphan_all(); @@ -1184,7 +1184,7 @@ public: _Emplace_back_internal(_STD move(_Val)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void prepend_range(_Rng&& _Range) { _Orphan_all(); @@ -1224,7 +1224,7 @@ public: } _Guard._Container = nullptr; } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 iterator insert(const_iterator _Where, const _Ty& _Val) { return emplace(_Where, _Val); @@ -1250,7 +1250,7 @@ public: _Off, _Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> iterator insert_range(const_iterator _Where, _Rng&& _Range) { const size_type _Off = static_cast(_Where - begin()); @@ -1262,7 +1262,7 @@ public: return _Insert_range<_Is_bidi::_Nope>(_Off, _RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 iterator insert(const_iterator _Where, initializer_list<_Ty> _Ilist) { return insert(_Where, _Ilist.begin(), _Ilist.end()); @@ -1712,11 +1712,11 @@ template >, deque(_Iter, _Iter, _Alloc = _Alloc()) -> deque<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> deque(from_range_t, _Rng&&, _Alloc = _Alloc()) -> deque<_RANGES range_value_t<_Rng>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _EXPORT_STD template void swap(deque<_Ty, _Alloc>& _Left, deque<_Ty, _Alloc>& _Right) noexcept /* strengthened */ { @@ -1736,13 +1736,13 @@ _NODISCARD bool operator!=(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Al } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result<_Ty> operator<=>(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -1763,7 +1763,7 @@ template _NODISCARD bool operator>=(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if _HAS_CXX20 _EXPORT_STD template diff --git a/stl/inc/expected b/stl/inc/expected index 69bee016bb..4992301048 100644 --- a/stl/inc/expected +++ b/stl/inc/expected @@ -7,7 +7,7 @@ #define _EXPECTED_ #include #if _STL_COMPILER_PREPROCESSOR -#if !_HAS_CXX23 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if !_HAS_CXX23 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later."); #else // ^^^ not supported / supported language mode vvv #include diff --git a/stl/inc/filesystem b/stl/inc/filesystem index a2abcecd46..ec31e27a72 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -2696,11 +2696,11 @@ namespace filesystem { } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD bool operator==(default_sentinel_t) const noexcept { return !_Impl; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _Directory_entry_proxy operator++(int) { _Directory_entry_proxy _Proxy(**this); @@ -2952,11 +2952,11 @@ namespace filesystem { } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD bool operator==(default_sentinel_t) const noexcept { return !_Impl; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _Directory_entry_proxy operator++(int) { _Directory_entry_proxy _Proxy(**this); @@ -4411,7 +4411,7 @@ struct hash { } }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template <> inline constexpr bool enable_borrowed_range = true; @@ -4422,7 +4422,7 @@ namespace ranges { template <> inline constexpr bool enable_view = true; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _STD_END diff --git a/stl/inc/format b/stl/inc/format index 38e6d6c6b8..dd5e5dc9e3 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -38,9 +38,9 @@ #define _FORMAT_ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_concepts +#if !_HAS_CXX20 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); -#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv +#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv #include <__msvc_format_ucd_tables.hpp> #include <__msvc_formatter.hpp> @@ -4068,6 +4068,6 @@ _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ _HAS_CXX20 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _FORMAT_ diff --git a/stl/inc/forward_list b/stl/inc/forward_list index 7a5da3e152..74a0036558 100644 --- a/stl/inc/forward_list +++ b/stl/inc/forward_list @@ -611,7 +611,7 @@ public: _Insert_op._Attach_after(_Mypair._Myval2._Before_head()); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> forward_list(from_range_t, _Rng&& _Range) : _Mypair(_Zero_then_variadic_args_t{}) { _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); @@ -627,7 +627,7 @@ public: _Alloc_proxy(); _Insert_op._Attach_after(_Mypair._Myval2._Before_head()); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 forward_list(forward_list&& _Right) noexcept // strengthened : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { @@ -919,12 +919,12 @@ public: _Insert_after(_Mypair._Myval2._Before_head(), _Val); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void prepend_range(_Rng&& _Range) { _Insert_range_after(_Mypair._Myval2._Before_head(), _RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void pop_front() noexcept /* strengthened */ { _Erase_after(_Mypair._Myval2._Before_head()); @@ -964,12 +964,12 @@ public: _Assign_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void assign_range(_Rng&& _Range) { _Assign_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void assign(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) { clear(); @@ -1026,7 +1026,7 @@ public: return _Insert_range_after(_Where._Ptr, _Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> iterator insert_range_after(const_iterator _Where, _Rng&& _Range) { #if _ITERATOR_DEBUG_LEVEL == 2 @@ -1035,7 +1035,7 @@ public: #endif // _ITERATOR_DEBUG_LEVEL == 2 return _Insert_range_after(_Where._Ptr, _RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 private: void _Erase_after(_Nodeptr _Pnode) noexcept { // erase element after _Pnode @@ -1560,11 +1560,11 @@ template >, forward_list(_Iter, _Iter, _Alloc = _Alloc()) -> forward_list<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> forward_list(from_range_t, _Rng&&, _Alloc = _Alloc()) -> forward_list<_RANGES range_value_t<_Rng>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _EXPORT_STD template void swap(forward_list<_Ty, _Alloc>& _Left, forward_list<_Ty, _Alloc>& _Right) noexcept /* strengthened */ { @@ -1584,14 +1584,14 @@ _NODISCARD bool operator!=(const forward_list<_Ty, _Alloc>& _Left, const forward } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result<_Ty> operator<=>( const forward_list<_Ty, _Alloc>& _Left, const forward_list<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin(), _Right._Unchecked_end_iter(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<(const forward_list<_Ty, _Alloc>& _Left, const forward_list<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -1612,7 +1612,7 @@ template _NODISCARD bool operator>=(const forward_list<_Ty, _Alloc>& _Left, const forward_list<_Ty, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if _HAS_CXX20 _EXPORT_STD template diff --git a/stl/inc/functional b/stl/inc/functional index ea1c2e63c0..59977f8a25 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -17,9 +17,9 @@ #endif // defined(_LEGACY_CODE_ASSUMES_FUNCTIONAL_INCLUDES_MEMORY) #include #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -586,11 +586,11 @@ _NODISCARD _CONSTEXPR20 _Mem_fn<_Rx _Ty::*> mem_fn(_Rx _Ty::*_Pm) noexcept { #if _HAS_CXX17 #if _HAS_CXX20 -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template concept _Can_invoke_then_negate = requires( _Callable&& _Fx, _Types&&... _Args) { !_STD invoke(_STD forward<_Callable>(_Fx), _STD forward<_Types>(_Args)...); }; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template inline constexpr bool _Can_invoke_then_negate_impl = false; template @@ -599,7 +599,7 @@ inline constexpr bool _Can_invoke_then_negate_impl< template inline constexpr bool _Can_invoke_then_negate = _Can_invoke_then_negate_impl; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #endif // _HAS_CXX20 struct _Not_fn_tag { @@ -620,7 +620,7 @@ public: constexpr _Not_fn(const _Not_fn&) = default; constexpr _Not_fn(_Not_fn&&) = default; -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 template requires _Can_invoke_then_negate<_Decayed&, _Types...> constexpr decltype(auto) operator()(_Types&&... _Args) & noexcept( @@ -696,7 +696,7 @@ public: template , int> = 0> void operator()(_Types&&...) const&& = delete; -#else // ^^^ _HAS_CXX20 && !defined(__cpp_lib_concepts) / !_HAS_CXX20 vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template auto operator()(_Types&&... _Args) & noexcept( noexcept(!_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...))) @@ -2126,7 +2126,7 @@ _CONSTEXPR20 auto _Call_binder(_Invoker_ret<_Ret>, index_sequence<_Ix...>, _Cv_F return _Invoker_ret<_Ret>::_Call(_Obj, _STD _Fix_arg(_STD get<_Ix>(_Tpl), _STD move(_Ut))...); } -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 template concept _Can_call_binder = requires(_CvFD& _Fx, _CvBoundTuple& _Bound_tuple, _UnboundTuple&& _Unbound_tuple) { _STD _Call_binder(_Invoker_ret<_Ret>{}, _IntSeq{}, _Fx, _Bound_tuple, _STD move(_Unbound_tuple)); @@ -2173,7 +2173,7 @@ public: _STD _Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, \ _STD forward_as_tuple(_STD forward<_Unbound>(_Unbargs)...)) -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 template requires _Can_call_binder<_Ret, _Fd, _Seq, _Bound_tuple, tuple<_Unbound&&...>> constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) noexcept(noexcept(_CALL_BINDER)) { @@ -2259,7 +2259,7 @@ constexpr auto _Call_front_binder(index_sequence<_Ix...>, _Cv_FD&& _Obj, _Cv_tup _STD forward<_Unbound>(_Unbargs)...); } -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template concept _Can_call_front_binder = requires(_CvFD&& _Fx, _CvBoundTuple&& _Bound_tuple, _Unbound&&... _Unbound_args) { _STD _Call_front_binder(_IntSeq{}, _STD forward<_CvFD>(_Fx), _STD forward<_CvBoundTuple>(_Bound_tuple), @@ -2296,7 +2296,7 @@ public: constexpr explicit _Front_binder(_FxInit&& _Func, _TypesInit&&... _Args) : _Mypair(_One_then_variadic_args_t{}, _STD forward<_FxInit>(_Func), _STD forward<_TypesInit>(_Args)...) {} -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template requires _Can_call_front_binder<_Seq, _Fx&, tuple<_Types...>&, _Unbound...> constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( @@ -2416,7 +2416,7 @@ constexpr auto _Call_back_binder(index_sequence<_Ix...>, _Cv_FD&& _Obj, _Cv_tupl _STD get<_Ix>(_STD forward<_Cv_tuple_TiD>(_Tpl))...); } -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template concept _Can_call_back_binder = requires(_CvFD&& _Fx, _CvBoundTuple&& _Bound_tuple, _Unbound&&... _Unbound_args) { _STD _Call_back_binder(_IntSeq{}, _STD forward<_CvFD>(_Fx), _STD forward<_CvBoundTuple>(_Bound_tuple), @@ -2453,7 +2453,7 @@ public: constexpr explicit _Back_binder(_FxInit&& _Func, _TypesInit&&... _Args) : _Mypair(_One_then_variadic_args_t{}, _STD forward<_FxInit>(_Func), _STD forward<_TypesInit>(_Args)...) {} -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template requires _Can_call_back_binder<_Seq, _Fx&, tuple<_Types...>&, _Unbound...> constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( @@ -3206,7 +3206,7 @@ private: }; #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD struct not_equal_to { template @@ -3241,7 +3241,7 @@ namespace ranges { using is_transparent = int; }; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_TR1_NAMESPACE namespace _DEPRECATE_TR1_NAMESPACE tr1 { diff --git a/stl/inc/iterator b/stl/inc/iterator index 47c3531806..b163d460ef 100644 --- a/stl/inc/iterator +++ b/stl/inc/iterator @@ -28,11 +28,11 @@ public: using container_type = _Container; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using difference_type = ptrdiff_t; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv using difference_type = void; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _CONSTEXPR20 explicit back_insert_iterator(_Container& _Cont) noexcept /* strengthened */ : container(_STD addressof(_Cont)) {} @@ -79,11 +79,11 @@ public: using container_type = _Container; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using difference_type = ptrdiff_t; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv using difference_type = void; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _CONSTEXPR20 explicit front_insert_iterator(_Container& _Cont) : container(_STD addressof(_Cont)) {} @@ -128,7 +128,7 @@ public: using reference = void; using container_type = _Container; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using difference_type = ptrdiff_t; using _Wrapped_iter = ranges::iterator_t<_Container>; #else // ^^^ implementing Ranges / no Ranges vvv @@ -169,7 +169,7 @@ protected: _Wrapped_iter iter; }; -#ifndef __cpp_lib_concepts +#if !_HAS_CXX20 template _NODISCARD _CONSTEXPR20 insert_iterator<_Container> inserter(_Container& _Cont, typename _Container::iterator _Where) { return insert_iterator<_Container>(_Cont, _Where); @@ -250,10 +250,10 @@ public: constexpr istream_iterator() noexcept(is_nothrow_default_constructible_v<_Ty>) /* strengthened */ {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 constexpr istream_iterator(default_sentinel_t) noexcept( is_nothrow_default_constructible_v<_Ty>) /* strengthened */ {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 istream_iterator(istream_type& _Istr) : _Myistr(_STD addressof(_Istr)) { _Getval(); @@ -284,11 +284,11 @@ public: return _Myistr == _Right._Myistr; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD_FRIEND bool operator==(const istream_iterator& _Left, default_sentinel_t) noexcept /* strengthened */ { return !_Left._Myistr; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 private: void _Getval() { // get a _Ty value if possible @@ -321,7 +321,7 @@ class ostream_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using difference_type = ptrdiff_t; #else using difference_type = void; @@ -376,9 +376,9 @@ public: using istream_type = basic_istream<_Elem, _Traits>; constexpr istreambuf_iterator() noexcept : _Strbuf(nullptr), _Got(true), _Val() {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 constexpr istreambuf_iterator(default_sentinel_t) noexcept : _Strbuf(nullptr), _Got(true), _Val() {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 istreambuf_iterator(istream_type& _Istr) noexcept : _Strbuf(_Istr.rdbuf()), _Got(!_Strbuf), _Val() {} @@ -447,7 +447,7 @@ public: return (!_Strbuf && !_Right._Strbuf) || (_Strbuf && _Right._Strbuf); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD_FRIEND bool operator==(const istreambuf_iterator& _Left, default_sentinel_t) { if (!_Left._Got) { _Left._Peek(); @@ -455,7 +455,7 @@ public: return !_Left._Strbuf; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 private: void _Inc() { // skip to next input element @@ -503,7 +503,7 @@ class ostreambuf_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using difference_type = ptrdiff_t; #else using difference_type = void; @@ -548,7 +548,7 @@ private: streambuf_type* _Strbuf; }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 enum class _Variantish_state : unsigned char { _Nothing, _Holds_first, _Holds_second }; struct _Variantish_empty_tag { @@ -1463,7 +1463,7 @@ template struct iterator_traits> : iterator_traits<_Iter> { using pointer = conditional_t, add_pointer_t>, void>; }; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _STD_END @@ -1481,9 +1481,9 @@ public: using difference_type = _STD ptrdiff_t; using pointer = _Ptr; using reference = _Pointee_type&; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = _STD contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 constexpr checked_array_iterator() = default; @@ -1695,9 +1695,9 @@ public: using difference_type = _STD ptrdiff_t; using pointer = _Ptr; using reference = _Pointee_type&; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = _STD contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 constexpr unchecked_array_iterator() = default; diff --git a/stl/inc/list b/stl/inc/list index 30a30caedf..452a117b68 100644 --- a/stl/inc/list +++ b/stl/inc/list @@ -886,7 +886,7 @@ public: _Construct_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> list(from_range_t, _Rng&& _Range) : _Mypair(_Zero_then_variadic_args_t{}) { _Construct_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -896,7 +896,7 @@ public: list(from_range_t, _Rng&& _Range, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 list(list&& _Right) noexcept(false) : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Alloc_sentinel_and_proxy(); @@ -1240,14 +1240,14 @@ public: _Emplace(_Mypair._Myval2._Myhead->_Next, _Val); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void prepend_range(_Rng&& _Range) { _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); _Op._Attach_before(_Mypair._Myval2, _Mypair._Myval2._Myhead->_Next); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void pop_front() noexcept /* strengthened */ { #if _CONTAINER_DEBUG_LEVEL > 0 @@ -1261,14 +1261,14 @@ public: _Emplace(_Mypair._Myval2._Myhead, _Val); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void append_range(_Rng&& _Range) { _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); _Op._Attach_at_end(_Mypair._Myval2); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void pop_back() noexcept /* strengthened */ { #if _CONTAINER_DEBUG_LEVEL > 0 @@ -1338,12 +1338,12 @@ public: _Assign_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void assign_range(_Rng&& _Range) { _Assign_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void assign(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) { // assign _Count * _Val const auto _Myend = _Mypair._Myval2._Myhead; @@ -1397,7 +1397,7 @@ public: return _Make_iter(_Op._Attach_before(_Mypair._Myval2, _Where._Ptr)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> iterator insert_range(const_iterator _Where, _Rng&& _Range) { #if _ITERATOR_DEBUG_LEVEL == 2 @@ -1407,7 +1407,7 @@ public: _Op._Append_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); return _Make_iter(_Op._Attach_before(_Mypair._Myval2, _Where._Ptr)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 iterator erase(const const_iterator _Where) noexcept /* strengthened */ { #if _ITERATOR_DEBUG_LEVEL == 2 @@ -1863,11 +1863,11 @@ template >, list(_Iter, _Iter, _Alloc = _Alloc()) -> list<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> list(from_range_t, _Rng&&, _Alloc = _Alloc()) -> list<_RANGES range_value_t<_Rng>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _EXPORT_STD template void swap(list<_Ty, _Alloc>& _Left, list<_Ty, _Alloc>& _Right) noexcept /* strengthened */ { @@ -1887,13 +1887,13 @@ _NODISCARD bool operator!=(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Allo } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result<_Ty> operator<=>(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -1914,7 +1914,7 @@ template _NODISCARD bool operator>=(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if _HAS_CXX20 _EXPORT_STD template diff --git a/stl/inc/map b/stl/inc/map index c8739b9013..52b59192a7 100644 --- a/stl/inc/map +++ b/stl/inc/map @@ -135,7 +135,7 @@ public: insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> map(from_range_t, _Rng&& _Range) : _Mybase(key_compare()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -155,7 +155,7 @@ public: map(from_range_t, _Rng&& _Range, const allocator_type& _Al) : _Mybase(key_compare(), _Al) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 map& operator=(const map& _Right) { _Mybase::operator=(_Right); @@ -383,7 +383,7 @@ map(_Iter, _Iter, _Alloc) -> map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, less< template ::value, int> = 0> map(initializer_list>, _Alloc) -> map<_Kty, _Ty, less<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Pr = less<_Range_key_type<_Rng>>, class _Alloc = allocator<_Range_to_alloc_type<_Rng>>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> @@ -393,7 +393,7 @@ map(from_range_t, _Rng&&, _Pr = _Pr(), _Alloc = _Alloc()) template <_RANGES input_range _Rng, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> map(from_range_t, _Rng&&, _Alloc) -> map<_Range_key_type<_Rng>, _Range_mapped_type<_Rng>, less<_Range_key_type<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template @@ -409,14 +409,14 @@ _NODISCARD bool operator!=(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_ } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result> operator<=>( const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_Kty, _Ty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin(), _Right._Unchecked_end_iter(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_Kty, _Ty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -437,7 +437,7 @@ template _NODISCARD bool operator>=(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_Kty, _Ty, _Pr, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template void swap(map<_Kty, _Ty, _Pr, _Alloc>& _Left, map<_Kty, _Ty, _Pr, _Alloc>& _Right) noexcept( @@ -515,7 +515,7 @@ public: insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> multimap(from_range_t, _Rng&& _Range) : _Mybase(key_compare()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -535,7 +535,7 @@ public: multimap(from_range_t, _Rng&& _Range, const allocator_type& _Al) : _Mybase(key_compare(), _Al) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 multimap& operator=(const multimap& _Right) { _Mybase::operator=(_Right); @@ -616,7 +616,7 @@ multimap(_Iter, _Iter, _Alloc) -> multimap<_Guide_key_t<_Iter>, _Guide_val_t<_It template ::value, int> = 0> multimap(initializer_list>, _Alloc) -> multimap<_Kty, _Ty, less<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Pr = less<_Range_key_type<_Rng>>, class _Alloc = allocator<_Range_to_alloc_type<_Rng>>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> @@ -626,7 +626,7 @@ multimap(from_range_t, _Rng&&, _Pr = _Pr(), _Alloc = _Alloc()) template <_RANGES input_range _Rng, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> multimap(from_range_t, _Rng&&, _Alloc) -> multimap<_Range_key_type<_Rng>, _Range_mapped_type<_Rng>, less<_Range_key_type<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template @@ -644,14 +644,14 @@ _NODISCARD bool operator!=( } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result> operator<=>( const multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, const multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin(), _Right._Unchecked_end_iter(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<( const multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, const multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) { @@ -676,7 +676,7 @@ _NODISCARD bool operator>=( const multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, const multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template void swap(multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) noexcept( diff --git a/stl/inc/mdspan b/stl/inc/mdspan index 22e8e6e750..62c0360232 100644 --- a/stl/inc/mdspan +++ b/stl/inc/mdspan @@ -7,7 +7,7 @@ #define _MDSPAN_ #include #if _STL_COMPILER_PREPROCESSOR -#if !_HAS_CXX23 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if !_HAS_CXX23 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later."); #else // ^^^ not supported / supported language mode vvv #include diff --git a/stl/inc/memory b/stl/inc/memory index d982b01e72..8bb7d7085a 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -47,7 +47,7 @@ _NoThrowFwdIt uninitialized_copy(_ExPo&&, const _FwdIt _First, const _FwdIt _Las } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using uninitialized_copy_result = in_out_result<_In, _Out>; @@ -120,7 +120,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_copy_fn uninitialized_copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NoThrowFwdIt uninitialized_copy_n(const _InIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) { @@ -163,7 +163,7 @@ _NoThrowFwdIt uninitialized_copy_n(_ExPo&&, const _FwdIt _First, const _Diff _Co } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using uninitialized_copy_n_result = in_out_result<_In, _Out>; @@ -212,7 +212,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_copy_n_fn uninitialized_copy_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_CXX17 _EXPORT_STD template @@ -237,7 +237,7 @@ _NoThrowFwdIt uninitialized_move(_ExPo&&, const _FwdIt _First, const _FwdIt _Las return _STD uninitialized_move(_First, _Last, _Dest); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Uninitialized_move_fn { public: @@ -271,7 +271,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_move_fn uninitialized_move; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template pair<_InIt, _NoThrowFwdIt> uninitialized_move_n(_InIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) { @@ -325,7 +325,7 @@ void uninitialized_fill(_ExPo&&, const _NoThrowFwdIt _First, const _NoThrowFwdIt } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD template using uninitialized_move_n_result = in_out_result<_In, _Out>; @@ -426,7 +426,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_fill_fn uninitialized_fill; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NoThrowFwdIt uninitialized_fill_n(_NoThrowFwdIt _First, const _Diff _Count_raw, const _Tval& _Val) { @@ -477,7 +477,7 @@ _NoThrowFwdIt uninitialized_fill_n( } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Uninitialized_fill_n_fn { public: @@ -550,7 +550,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Destroy_at_fn destroy_at; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_CXX17 _EXPORT_STD template @@ -563,7 +563,7 @@ _CONSTEXPR20 void destroy(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) _EXPORT_STD template = 0> void destroy(_ExPo&& _Exec, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept; // terminates -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible> @@ -602,7 +602,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Destroy_fn destroy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { @@ -628,7 +628,7 @@ _CONSTEXPR20 _NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_ra _EXPORT_STD template = 0> _NoThrowFwdIt destroy_n(_ExPo&& _Exec, _NoThrowFwdIt _First, _Diff _Count_raw) noexcept; // terminates -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Destroy_n_fn { public: @@ -658,7 +658,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Destroy_n_fn destroy_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template void uninitialized_default_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { @@ -679,7 +679,7 @@ void uninitialized_default_construct(const _NoThrowFwdIt _First, const _NoThrowF _EXPORT_STD template = 0> void uninitialized_default_construct(_ExPo&& _Exec, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept; // terminates -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Uninitialized_default_construct_fn { public: @@ -727,7 +727,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_default_construct_fn uninitialized_default_construct; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NoThrowFwdIt uninitialized_default_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { @@ -756,7 +756,7 @@ _EXPORT_STD template void uninitialized_value_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { @@ -809,7 +809,7 @@ void uninitialized_value_construct(const _NoThrowFwdIt _First, const _NoThrowFwd _EXPORT_STD template = 0> void uninitialized_value_construct(_ExPo&& _Exec, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept; // terminates -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Uninitialized_value_construct_fn { public: @@ -855,7 +855,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_value_construct_fn uninitialized_value_construct; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NoThrowFwdIt uninitialized_value_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { @@ -873,7 +873,7 @@ _EXPORT_STD template & _Left, const unique_ptr return !(_Right < _Left); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // clang-format off _EXPORT_STD template requires three_way_comparable_with::pointer, @@ -3514,7 +3514,7 @@ _NODISCARD compare_three_way_result_t::pointer, // clang-format on return _Left.get() <=> _Right.get(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR23 bool operator==(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t) noexcept { @@ -3580,14 +3580,14 @@ _NODISCARD _CONSTEXPR23 bool operator<=(nullptr_t _Left, const unique_ptr<_Ty, _ return !(_Right < _Left); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template requires three_way_comparable::pointer> _NODISCARD _CONSTEXPR23 compare_three_way_result_t::pointer> operator<=>( const unique_ptr<_Ty, _Dx>& _Left, nullptr_t) { return _Left.get() <=> static_cast::pointer>(nullptr); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template struct _Can_stream_unique_ptr : false_type {}; @@ -4098,7 +4098,7 @@ public: }; #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template struct _Pointer_of_helper {}; @@ -4300,7 +4300,7 @@ _NODISCARD auto inout_ptr(_SmartPtr& _Smart_ptr, _ArgsT&&... _Args) { return inout_ptr_t<_SmartPtr, _Pointer, _ArgsT&&...>(_Smart_ptr, _STD forward<_ArgsT>(_Args)...); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #if _HAS_TR1_NAMESPACE namespace _DEPRECATE_TR1_NAMESPACE tr1 { diff --git a/stl/inc/numbers b/stl/inc/numbers index 3d27bf35f0..78e2954b73 100644 --- a/stl/inc/numbers +++ b/stl/inc/numbers @@ -10,11 +10,11 @@ #if !_HAS_CXX20 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); #else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv #include -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -25,7 +25,7 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN namespace numbers { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template struct _Invalid { static_assert(_Always_false<_Ty>, "A program that instantiates a primary template of a mathematical constant " @@ -85,7 +85,7 @@ namespace numbers { inline constexpr _Floating egamma_v<_Floating> = static_cast<_Floating>(0.5772156649015329); template inline constexpr _Floating phi_v<_Floating> = static_cast<_Floating>(1.618033988749895); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template struct _Reject_invalid { static_assert(is_floating_point_v<_Ty>, "A program that instantiates a primary template of a mathematical " @@ -122,7 +122,7 @@ namespace numbers { inline constexpr _Ty egamma_v = static_cast<_Reject_invalid_t<_Ty>>(0.5772156649015329); _EXPORT_STD template inline constexpr _Ty phi_v = static_cast<_Reject_invalid_t<_Ty>>(1.618033988749895); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD inline constexpr double e = e_v; _EXPORT_STD inline constexpr double log2e = log2e_v; diff --git a/stl/inc/numeric b/stl/inc/numeric index e3c2cdc727..a20bc33e6d 100644 --- a/stl/inc/numeric +++ b/stl/inc/numeric @@ -525,7 +525,7 @@ _CONSTEXPR20 void iota(_FwdIt _First, _FwdIt _Last, _Ty _Val) { } } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 namespace ranges { _EXPORT_STD template using iota_result = out_value_result<_Out, _Ty>; @@ -565,7 +565,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Iota_fn iota; } // namespace ranges -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #if _HAS_CXX17 template diff --git a/stl/inc/optional b/stl/inc/optional index b18ca17533..9c01b35660 100644 --- a/stl/inc/optional +++ b/stl/inc/optional @@ -586,7 +586,7 @@ public: } } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _Fn> requires copy_constructible<_Ty> constexpr optional or_else(_Fn&& _Func) const& { @@ -612,7 +612,7 @@ public: return _STD forward<_Fn>(_Func)(); } } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 using _Mybase::reset; @@ -624,11 +624,11 @@ optional(_Ty) -> optional<_Ty>; _EXPORT_STD template _NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_Fake_copy_init(*_Left == *_Right))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { *_Left == *_Right } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { const bool _Left_has_value = _Left.has_value(); const bool _Right_has_value = _Right.has_value(); @@ -641,11 +641,11 @@ _NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const optional _EXPORT_STD template _NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_Fake_copy_init(*_Left != *_Right))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { *_Left != *_Right } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { const bool _Left_has_value = _Left.has_value(); const bool _Right_has_value = _Right.has_value(); @@ -658,11 +658,11 @@ _NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const optional _EXPORT_STD template _NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_Fake_copy_init(*_Left < *_Right))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { *_Left < *_Right } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { const bool _Left_has_value = _Left.has_value(); const bool _Right_has_value = _Right.has_value(); @@ -675,11 +675,11 @@ _NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const optional< _EXPORT_STD template _NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_Fake_copy_init(*_Left > *_Right))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { *_Left > *_Right } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { const bool _Left_has_value = _Left.has_value(); const bool _Right_has_value = _Right.has_value(); @@ -692,11 +692,11 @@ _NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const optional< _EXPORT_STD template _NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_Fake_copy_init(*_Left <= *_Right))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { *_Left <= *_Right } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { const bool _Left_has_value = _Left.has_value(); const bool _Right_has_value = _Right.has_value(); @@ -709,11 +709,11 @@ _NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const optional _EXPORT_STD template _NODISCARD constexpr bool operator>=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_Fake_copy_init(*_Left >= *_Right))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { *_Left >= *_Right } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { const bool _Left_has_value = _Left.has_value(); const bool _Right_has_value = _Right.has_value(); @@ -723,7 +723,7 @@ _NODISCARD constexpr bool operator>=(const optional<_Ty1>& _Left, const optional return _Left_has_value >= _Right_has_value; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _Ty2> _NODISCARD constexpr compare_three_way_result_t<_Ty1, _Ty2> operator<=>(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept(noexcept(*_Left <=> *_Right)) /* strengthened */ { @@ -735,7 +735,7 @@ _NODISCARD constexpr compare_three_way_result_t<_Ty1, _Ty2> operator<=>(const op return _Left_has_value <=> _Right_has_value; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr bool operator==(const optional<_Ty>& _Left, nullopt_t) noexcept { @@ -929,7 +929,7 @@ _NODISCARD constexpr bool operator>=(const _Ty1& _Left, const optional<_Ty2>& _R return true; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template requires (!_Derived_from_specialization_of<_Ty2, optional>) && three_way_comparable_with<_Ty1, _Ty2> _NODISCARD constexpr compare_three_way_result_t<_Ty1, _Ty2> operator<=>( @@ -940,7 +940,7 @@ _NODISCARD constexpr compare_three_way_result_t<_Ty1, _Ty2> operator<=>( return strong_ordering::less; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template && is_swappable_v<_Ty>, int> = 0> _CONSTEXPR20 void swap(optional<_Ty>& _Left, optional<_Ty>& _Right) noexcept(noexcept(_Left.swap(_Right))) { diff --git a/stl/inc/queue b/stl/inc/queue index 9ed22d5137..bf06027472 100644 --- a/stl/inc/queue +++ b/stl/inc/queue @@ -11,9 +11,9 @@ #include #include -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 #include -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -48,10 +48,10 @@ public: queue(_InIt _First, _InIt _Last) noexcept(is_nothrow_constructible_v<_Container, _InIt, _InIt>) // strengthened : c(_STD move(_First), _STD move(_Last)) {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_Container_compatible_range<_Ty> _Rng> queue(from_range_t, _Rng&& _Range) : c(_RANGES to<_Container>(_STD forward<_Rng>(_Range))) {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 template , int> = 0> @@ -81,11 +81,11 @@ public: is_nothrow_constructible_v<_Container, _InIt, _InIt, const _Alloc&>) // strengthened : c(_STD move(_First), _STD move(_Last), _Al) {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_Container_compatible_range<_Ty> _Rng, class _Alloc> queue(from_range_t, _Rng&& _Range, const _Alloc& _Al) : c(_RANGES to<_Container>(_STD forward<_Rng>(_Range), _Al)) {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _NODISCARD_EMPTY_ADAPTOR_MEMBER bool empty() const noexcept(noexcept(c.empty())) /* strengthened */ { @@ -120,7 +120,7 @@ public: c.push_back(_STD move(_Val)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void push_range(_Rng&& _Range) { if constexpr (requires { c.append_range(_Range); }) { @@ -129,7 +129,7 @@ public: _RANGES copy(_Range, back_insert_iterator{c}); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template decltype(auto) emplace(_Valty&&... _Val) { @@ -171,12 +171,12 @@ template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> queue(_InIt, _InIt, _Alloc = _Alloc()) -> queue<_Iter_value_t<_InIt>, deque<_Iter_value_t<_InIt>, _Alloc>>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> queue(from_range_t, _Rng&&, _Alloc = _Alloc()) -> queue<_RANGES range_value_t<_Rng>, deque<_RANGES range_value_t<_Rng>, _Alloc>>; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _EXPORT_STD template @@ -209,13 +209,13 @@ _NODISCARD bool operator>=(const queue<_Ty, _Container>& _Left, const queue<_Ty, return _Left._Get_container() >= _Right._Get_container(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD compare_three_way_result_t<_Container> operator<=>( const queue<_Ty, _Container>& _Left, const queue<_Ty, _Container>& _Right) { return _Left._Get_container() <=> _Right._Get_container(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template ::value, int> = 0> void swap(queue<_Ty, _Container>& _Left, queue<_Ty, _Container>& _Right) noexcept(noexcept(_Left.swap(_Right))) { @@ -276,13 +276,13 @@ public: _Make_heap(); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> priority_queue(from_range_t, _Rng&& _Range, const _Pr& _Pred = _Pr()) : c(_RANGES to<_Container>(_STD forward<_Rng>(_Range))), comp(_Pred) { _Make_heap(); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template , int> = 0> explicit priority_queue(const _Alloc& _Al) noexcept( @@ -344,7 +344,7 @@ public: _Make_heap(); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng, class _Alloc, enable_if_t, int> = 0> priority_queue(from_range_t, _Rng&& _Range, const _Pr& _Pred, const _Alloc& _Al) @@ -358,7 +358,7 @@ public: : c(_RANGES to<_Container>(_STD forward<_Rng>(_Range), _Al)), comp() { _Make_heap(); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _NODISCARD_EMPTY_ADAPTOR_MEMBER bool empty() const noexcept(noexcept(c.empty())) /* strengthened */ { return c.empty(); @@ -382,7 +382,7 @@ public: _STD push_heap(c.begin(), c.end(), _STD _Pass_fn(comp)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void push_range(_Rng&& _Range) { const size_type _Old_size = c.size(); @@ -405,7 +405,7 @@ public: } } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template void emplace(_Valty&&... _Val) { @@ -465,7 +465,7 @@ template priority_queue; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Pr = less<_RANGES range_value_t<_Rng>>, enable_if_t::value, int> = 0> priority_queue(from_range_t, _Rng&&, _Pr = _Pr()) @@ -479,7 +479,7 @@ priority_queue(from_range_t, _Rng&&, _Pr, _Alloc) template <_RANGES input_range _Rng, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> priority_queue(from_range_t, _Rng&&, _Alloc) -> priority_queue<_RANGES range_value_t<_Rng>, vector<_RANGES range_value_t<_Rng>, _Alloc>>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> set(from_range_t, _Rng&& _Range) : _Mybase(key_compare()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -132,7 +132,7 @@ public: set(from_range_t, _Rng&& _Range, const allocator_type& _Al) : _Mybase(key_compare(), _Al) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 set& operator=(const set& _Right) { _Mybase::operator=(_Right); @@ -194,7 +194,7 @@ set(_Iter, _Iter, _Alloc) -> set<_Iter_value_t<_Iter>, less<_Iter_value_t<_Iter> template ::value, int> = 0> set(initializer_list<_Kty>, _Alloc) -> set<_Kty, less<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Pr = less<_RANGES range_value_t<_Rng>>, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> @@ -202,7 +202,7 @@ set(from_range_t, _Rng&&, _Pr = _Pr(), _Alloc = _Alloc()) -> set<_RANGES range_v template <_RANGES input_range _Rng, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> set(from_range_t, _Rng&&, _Alloc) -> set<_RANGES range_value_t<_Rng>, less<_RANGES range_value_t<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template @@ -218,14 +218,14 @@ _NODISCARD bool operator!=(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result<_Kty> operator<=>( const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin(), _Right._Unchecked_end_iter(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -246,7 +246,7 @@ template _NODISCARD bool operator>=(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, _Pr, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template void swap(set<_Kty, _Pr, _Alloc>& _Left, set<_Kty, _Pr, _Alloc>& _Right) noexcept(noexcept(_Left.swap(_Right))) { @@ -322,7 +322,7 @@ public: this->insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> multiset(from_range_t, _Rng&& _Range) : _Mybase(key_compare()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -342,7 +342,7 @@ public: multiset(from_range_t, _Rng&& _Range, const allocator_type& _Al) : _Mybase(key_compare(), _Al) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 multiset& operator=(const multiset& _Right) { _Mybase::operator=(_Right); @@ -410,7 +410,7 @@ multiset(_Iter, _Iter, _Alloc) -> multiset<_Iter_value_t<_Iter>, less<_Iter_valu template ::value, int> = 0> multiset(initializer_list<_Kty>, _Alloc) -> multiset<_Kty, less<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Pr = less<_RANGES range_value_t<_Rng>>, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t>, _Is_allocator<_Alloc>>, int> = 0> @@ -419,7 +419,7 @@ multiset(from_range_t, _Rng&&, _Pr = _Pr(), _Alloc = _Alloc()) -> multiset<_RANG template <_RANGES input_range _Rng, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> multiset(from_range_t, _Rng&&, _Alloc) -> multiset<_RANGES range_value_t<_Rng>, less<_RANGES range_value_t<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template @@ -435,14 +435,14 @@ _NODISCARD bool operator!=(const multiset<_Kty, _Pr, _Alloc>& _Left, const multi } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD _Synth_three_way_result<_Kty> operator<=>( const multiset<_Kty, _Pr, _Alloc>& _Left, const multiset<_Kty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin(), _Right._Unchecked_end_iter(), _Synth_three_way{}); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD bool operator<(const multiset<_Kty, _Pr, _Alloc>& _Left, const multiset<_Kty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -463,7 +463,7 @@ template _NODISCARD bool operator>=(const multiset<_Kty, _Pr, _Alloc>& _Left, const multiset<_Kty, _Pr, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template void swap(multiset<_Kty, _Pr, _Alloc>& _Left, multiset<_Kty, _Pr, _Alloc>& _Right) noexcept( diff --git a/stl/inc/span b/stl/inc/span index df3a5a47df..943d673035 100644 --- a/stl/inc/span +++ b/stl/inc/span @@ -29,9 +29,9 @@ _EXPORT_STD inline constexpr size_t dynamic_extent = static_cast(-1); template struct _Span_iterator { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = remove_cv_t<_Ty>; using difference_type = ptrdiff_t; @@ -224,7 +224,7 @@ struct _Span_extent_type<_Ty, dynamic_extent> { _EXPORT_STD template class span; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template inline constexpr bool enable_view> = true; @@ -257,7 +257,7 @@ concept _Span_compatible_range = && (_RANGES borrowed_range<_Rng> || is_const_v<_Ty>) && is_convertible_v>(*)[], _Ty(*)[]>; // clang-format on -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template struct _Is_span : false_type {}; @@ -290,7 +290,7 @@ inline constexpr bool _Is_span_compatible_range = conjunction_v< // _Has_container_interface<_Rng>, // _Is_span_convertible_range<_Rng, _Ty>>; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ // [views.span] _EXPORT_STD template @@ -311,15 +311,15 @@ public: using const_reference = const _Ty&; using iterator = _Span_iterator<_Ty>; using reverse_iterator = _STD reverse_iterator; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 using const_iterator = _STD const_iterator; using const_reverse_iterator = _STD const_iterator; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 static constexpr size_type extent = _Extent; // [span.cons] Constructors, copy, and assignment -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // clang-format off constexpr span() noexcept requires (_Extent == 0 || _Extent == dynamic_extent) = default; @@ -387,7 +387,7 @@ public: #endif // _CONTAINER_DEBUG_LEVEL > 0 } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template = 0> constexpr span() noexcept {} @@ -466,7 +466,7 @@ public: #endif // _CONTAINER_DEBUG_LEVEL > 0 } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ // [span.sub] Subviews template @@ -609,7 +609,7 @@ public: #endif // ^^^ _ITERATOR_DEBUG_LEVEL == 0 ^^^ } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 _NODISCARD constexpr const_iterator cbegin() const noexcept { return begin(); } @@ -617,7 +617,7 @@ public: _NODISCARD constexpr const_iterator cend() const noexcept { return end(); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _NODISCARD constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; @@ -627,7 +627,7 @@ public: return reverse_iterator{begin()}; } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 _NODISCARD constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } @@ -635,7 +635,7 @@ public: _NODISCARD constexpr const_reverse_iterator crend() const noexcept { return rend(); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _NODISCARD constexpr pointer _Unchecked_begin() const noexcept { return _Mydata; @@ -655,7 +655,7 @@ span(array<_Ty, _Size>&) -> span<_Ty, _Size>; template span(const array<_Ty, _Size>&) -> span; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template span(_It, _End) -> span>>; @@ -663,7 +663,7 @@ span(_It, _End) -> span>>; template <_RANGES contiguous_range _Rng> span(_Rng&&) -> span>>; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template span(_Rng&) -> span; @@ -671,7 +671,7 @@ span(_Rng&) -> span; template span(const _Rng&) -> span; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #ifdef __cpp_lib_byte // [span.objectrep] Views of object representation diff --git a/stl/inc/spanstream b/stl/inc/spanstream index af07689db0..9c5d31feaa 100644 --- a/stl/inc/spanstream +++ b/stl/inc/spanstream @@ -10,9 +10,9 @@ #if !_HAS_CXX23 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later."); #else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #include #include #include @@ -215,14 +215,14 @@ public: _Mybase::set_rdbuf(_STD addressof(_Buf)); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_RANGES borrowed_range _ReadOnlyRange> requires ( !convertible_to<_ReadOnlyRange, _STD span<_Elem>> && convertible_to<_ReadOnlyRange, _STD span>) explicit basic_ispanstream(_ReadOnlyRange&& _Range) : basic_ispanstream( _STD span<_Elem>{const_cast<_Elem*>(_RANGES data(_Range)), static_cast(_RANGES size(_Range))}) {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 basic_ispanstream& operator=(const basic_ispanstream&) = delete; @@ -251,7 +251,7 @@ public: rdbuf()->span(_Span); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_RANGES borrowed_range _ReadOnlyRange> requires ( !convertible_to<_ReadOnlyRange, _STD span<_Elem>> && convertible_to<_ReadOnlyRange, _STD span>) @@ -259,7 +259,7 @@ public: this->span( _STD span<_Elem>{const_cast<_Elem*>(_RANGES data(_Range)), static_cast(_RANGES size(_Range))}); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 private: _Mysb _Buf; diff --git a/stl/inc/stack b/stl/inc/stack index e311d6e72a..482bca7201 100644 --- a/stl/inc/stack +++ b/stl/inc/stack @@ -9,9 +9,9 @@ #if _STL_COMPILER_PREPROCESSOR #include -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 #include -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -46,10 +46,10 @@ public: stack(_InIt _First, _InIt _Last) noexcept(is_nothrow_constructible_v<_Container, _InIt, _InIt>) // strengthened : c(_STD move(_First), _STD move(_Last)) {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_Container_compatible_range<_Ty> _Rng> stack(from_range_t, _Rng&& _Range) : c(_RANGES to<_Container>(_STD forward<_Rng>(_Range))) {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 template , int> = 0> @@ -79,11 +79,11 @@ public: is_nothrow_constructible_v<_Container, _InIt, _InIt, const _Alloc&>) // strengthened : c(_STD move(_First), _STD move(_Last), _Al) {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_Container_compatible_range<_Ty> _Rng, class _Alloc> stack(from_range_t, _Rng&& _Range, const _Alloc& _Al) : c(_RANGES to<_Container>(_STD forward<_Rng>(_Range), _Al)) {} -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _NODISCARD_EMPTY_ADAPTOR_MEMBER bool empty() const noexcept(noexcept(c.empty())) /* strengthened */ { @@ -110,7 +110,7 @@ public: c.push_back(_STD move(_Val)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> void push_range(_Rng&& _Range) { if constexpr (requires { c.append_range(_Range); }) { @@ -119,7 +119,7 @@ public: _RANGES copy(_Range, back_insert_iterator{c}); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template decltype(auto) emplace(_Valty&&... _Val) { @@ -161,13 +161,13 @@ template >, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> stack(_InIt, _InIt, _Alloc = _Alloc()) -> stack<_Iter_value_t<_InIt>, deque<_Iter_value_t<_InIt>, _Alloc>>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_RANGES input_range _Rng> stack(from_range_t, _Rng&&) -> stack<_RANGES range_value_t<_Rng>>; template <_RANGES input_range _Rng, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> stack(from_range_t, _Rng&&, _Alloc) -> stack<_RANGES range_value_t<_Rng>, deque<_RANGES range_value_t<_Rng>, _Alloc>>; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _EXPORT_STD template @@ -200,13 +200,13 @@ _NODISCARD bool operator>=(const stack<_Ty, _Container>& _Left, const stack<_Ty, return _Left._Get_container() >= _Right._Get_container(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD compare_three_way_result_t<_Container> operator<=>( const stack<_Ty, _Container>& _Left, const stack<_Ty, _Container>& _Right) { return _Left._Get_container() <=> _Right._Get_container(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template ::value, int> = 0> void swap(stack<_Ty, _Container>& _Left, stack<_Ty, _Container>& _Right) noexcept(noexcept(_Left.swap(_Right))) { diff --git a/stl/inc/stacktrace b/stl/inc/stacktrace index 32ffc28b3c..5f9270ce1f 100644 --- a/stl/inc/stacktrace +++ b/stl/inc/stacktrace @@ -17,9 +17,9 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -268,9 +268,9 @@ public: return _Result; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 return _STD lexicographical_compare_three_way(_Lhs.begin(), _Lhs.end(), _Rhs.begin(), _Rhs.end()); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv for (size_t _Ix = 0, _Mx = _Lhs._Frames.size(); _Ix != _Mx; ++_Ix) { if (_Lhs._Frames[_Ix] != _Rhs._Frames[_Ix]) { return _Lhs._Frames[_Ix] <=> _Rhs._Frames[_Ix]; @@ -278,7 +278,7 @@ public: } return strong_ordering::equal; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ } void swap(basic_stacktrace& _Other) noexcept(allocator_traits<_Alloc>::propagate_on_container_swap::value @@ -352,7 +352,7 @@ ostream& operator<<(ostream& _Os, const basic_stacktrace<_Alloc>& _St) { return _Os << _STD to_string(_St); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <> struct formatter { constexpr format_parse_context::iterator parse(format_parse_context& _Parse_ctx) { @@ -386,7 +386,7 @@ struct formatter> { return _RANGES copy(_STD to_string(_Val), _Format_ctx.out()).out; } }; -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 namespace pmr { _EXPORT_STD using stacktrace = basic_stacktrace>; diff --git a/stl/inc/system_error b/stl/inc/system_error index bb3f657964..e0004f37e8 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -110,11 +110,11 @@ public: } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD strong_ordering operator<=>(const error_category& _Right) const noexcept { return _Bit_cast(_Addr) <=> _Bit_cast(_Right._Addr); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD bool operator<(const error_category& _Right) const noexcept { #ifdef _M_CEE_PURE return _Addr < _Right._Addr; @@ -122,7 +122,7 @@ public: return _Bit_cast(_Addr) < _Bit_cast(_Right._Addr); #endif // ^^^ !defined(_M_CEE_PURE) ^^^ } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; @@ -222,19 +222,19 @@ public: return _System_error_equal(_Left, _Right); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD_FRIEND strong_ordering operator<=>(const error_code& _Left, const error_code& _Right) noexcept { if (const auto _Result = _Left.category() <=> _Right.category(); _Result != 0) { return _Result; } return _Left.value() <=> _Right.value(); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD_FRIEND bool operator<(const error_code& _Left, const error_code& _Right) noexcept { return _Left.category() < _Right.category() || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if !_HAS_CXX20 _NODISCARD_FRIEND bool operator==(const error_condition& _Left, const error_code& _Right) noexcept { return _System_error_equal(_Right, _Left); @@ -309,7 +309,7 @@ public: return _Left.category() == _Right.category() && _Left.value() == _Right.value(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD_FRIEND strong_ordering operator<=>( const error_condition& _Left, const error_condition& _Right) noexcept { if (const auto _Result = _Left.category() <=> _Right.category(); _Result != 0) { @@ -317,12 +317,12 @@ public: } return _Left.value() <=> _Right.value(); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD_FRIEND bool operator<(const error_condition& _Left, const error_condition& _Right) noexcept { return _Left.category() < _Right.category() || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if !_HAS_CXX20 _NODISCARD_FRIEND bool operator!=(const error_condition& _Left, const error_condition& _Right) noexcept { return !(_Left == _Right); @@ -362,7 +362,7 @@ _EXPORT_STD _NODISCARD inline bool operator==(const error_condition& _Left, cons return _Left.category() == _Right.category() && _Left.value() == _Right.value(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD _NODISCARD inline strong_ordering operator<=>(const error_code& _Left, const error_code& _Right) noexcept { if (const auto _Result = _Left.category() <=> _Right.category(); _Result != 0) { return _Result; @@ -377,7 +377,7 @@ _EXPORT_STD _NODISCARD inline strong_ordering operator<=>( } return _Left.value() <=> _Right.value(); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD inline bool operator<(const error_code& _Left, const error_code& _Right) noexcept { return _Left.category() < _Right.category() || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); @@ -387,7 +387,7 @@ _NODISCARD inline bool operator<(const error_condition& _Left, const error_condi return _Left.category() < _Right.category() || (_Left.category() == _Right.category() && _Left.value() < _Right.value()); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #if !_HAS_CXX20 _NODISCARD inline bool operator==(const error_condition& _Left, const error_code& _Right) noexcept { diff --git a/stl/inc/thread b/stl/inc/thread index 2d47227b13..b3f1915989 100644 --- a/stl/inc/thread +++ b/stl/inc/thread @@ -23,9 +23,9 @@ #include #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 #include -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -296,7 +296,7 @@ basic_ostream<_Ch, _Tr>& operator<<(basic_ostream<_Ch, _Tr>& _Str, thread::id _I return _Str << _RNext; } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 // Per LWG-3997, `_CharT` in library-provided `formatter` specializations is // constrained to character types supported by `format`. template <_Format_supported_charT _CharT> @@ -322,7 +322,7 @@ public: private: _Fill_align_and_width_formatter<_CharT> _Impl; }; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template <> struct hash { diff --git a/stl/inc/tuple b/stl/inc/tuple index 217c4d7030..28eea723a9 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -7,9 +7,9 @@ #define _TUPLE_ #include #if _STL_COMPILER_PREPROCESSOR -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #include <__msvc_iter_core.hpp> #include @@ -178,7 +178,7 @@ struct _Alloc_unpack_tuple_t { explicit _Alloc_unpack_tuple_t() = default; }; // tag type to disambiguate construction (from an allocator and unpacking a tuple/pair) -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template >> inline constexpr bool _Can_construct_values_from_tuple_like_v = false; @@ -216,7 +216,7 @@ using _Three_way_comparison_result_with_tuple_like_t = template concept _Tuple_like_non_tuple = !_Is_specialization_v<_Ty, tuple> && _Tuple_like<_Ty>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template <> class tuple<> { // empty tuple @@ -225,11 +225,11 @@ public: constexpr tuple(const tuple&) noexcept /* strengthened */ {} // TRANSITION, ABI: should be defaulted -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template <_Different_from _Other> requires _Tuple_like<_Other> && (tuple_size_v> == 0) constexpr tuple(_Other&&) noexcept /* strengthened */ {} -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc&) noexcept /* strengthened */ {} @@ -237,11 +237,11 @@ public: template _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept /* strengthened */ {} -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template _Other> requires _Tuple_like<_Other> && (tuple_size_v> == 0) constexpr tuple(allocator_arg_t, const _Alloc&, _Other&&) noexcept /* strengthened */ {} -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template , int> = 0> constexpr tuple(_Tag) noexcept /* strengthened */ {} @@ -255,7 +255,7 @@ public: return *this; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_Different_from _Other> requires _Tuple_like<_Other> && (tuple_size_v> == 0) constexpr tuple& operator=(_Other&&) noexcept /* strengthened */ { @@ -267,7 +267,7 @@ public: constexpr const tuple& operator=(_Other&&) const noexcept /* strengthened */ { return *this; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _CONSTEXPR20 void swap(tuple&) noexcept {} @@ -279,17 +279,17 @@ public: return true; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD constexpr strong_ordering _Three_way_compare(const tuple&) const noexcept { return strong_ordering::equal; } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD constexpr bool _Less(const tuple&) const noexcept { return false; } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template <_Tuple_like_non_tuple _Other> _NODISCARD_FRIEND constexpr bool operator==(const tuple&, const _Other&) noexcept /* strengthened */ { static_assert(tuple_size_v<_Other> == 0, "Cannot compare tuples of different sizes (N4950 [tuple.rel]/2)."); @@ -301,7 +301,7 @@ public: _NODISCARD_FRIEND constexpr strong_ordering operator<=>(const tuple&, const _Other&) noexcept /* strengthened */ { return strong_ordering::equal; } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 }; template @@ -423,7 +423,7 @@ public: _Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template > static constexpr bool _Is_tuple_like_constructor_explicit_v = false; @@ -444,7 +444,7 @@ public: constexpr explicit(_Is_tuple_like_constructor_explicit_v<_Other>) tuple(_Other&& _Right) : tuple(_Unpack_tuple_t{}, _STD forward<_Other>(_Right)) { } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 template && _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} -#ifdef __cpp_lib_concepts -#ifdef __clang__ // TRANSITION, LLVM-59827 +#if _HAS_CXX20 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 (Clang), VSO-1900279 (EDG) template , int> = 0> #else // ^^^ workaround / no workaround vvv template _Other> @@ -553,7 +553,7 @@ public: tuple(allocator_arg_t, const _Alloc& _Al, _Other&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD forward<_Other>(_Right)) { } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 tuple& operator=(const volatile tuple&) = delete; @@ -689,7 +689,7 @@ public: return *this; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template > static constexpr bool _Can_assign_values_from_tuple_like_v = false; @@ -730,7 +730,7 @@ public: _Assign_tuple_like(_STD forward<_Other>(_Right), make_index_sequence<1 + sizeof...(_Rest)>{}); return *this; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _CONSTEXPR20 void swap(tuple& _Right) noexcept( @@ -763,7 +763,7 @@ public: return _Myfirst._Val == _Right._Myfirst._Val && _Mybase::_Equals(_Right._Get_rest()); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_This, _First>, _Synth_three_way_result<_Rest, _Other>...> @@ -813,13 +813,13 @@ public: return _Left._Three_way_compare_with_tuple_like(_Right, make_index_sequence<1 + sizeof...(_Rest)>{}); } #endif // _HAS_CXX23 -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD constexpr bool _Less(const tuple<_Other...>& _Right) const { return _Myfirst._Val < _Right._Myfirst._Val || (!(_Right._Myfirst._Val < _Myfirst._Val) && _Mybase::_Less(_Right._Get_rest())); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ template friend constexpr tuple_element_t<_Index, tuple<_Types...>>& get(tuple<_Types...>& _Tuple) noexcept; @@ -875,13 +875,13 @@ _NODISCARD constexpr bool operator==(const tuple<_Types1...>& _Left, const tuple return _Left._Equals(_Right); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Types1, _Types2>...> operator<=>( const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { return _Left._Three_way_compare(_Right); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv #if !_HAS_CXX20 template _NODISCARD constexpr bool operator!=(const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { @@ -909,7 +909,7 @@ template _NODISCARD constexpr bool operator<=(const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { return !(_Right < _Left); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template ...>, int> = 0> _CONSTEXPR20 void swap(tuple<_Types...>& _Left, tuple<_Types...>& _Right) noexcept(noexcept(_Left.swap(_Right))) { @@ -1040,7 +1040,7 @@ struct _Tuple_cat2<_Ty, index_sequence<_Kx...>, index_sequence<_Ix...>, _Ix_next index_sequence<_Ix..., (_Ix_next + 0 * _Kx_next)...>, // repeat _Ix_next, ignoring the elements of _Kx_next _Ix_next + 1, _Rest...> {}; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template <_Tuple_like... _Tuples> #else // ^^^ C++23 / C++20 vvv template @@ -1053,7 +1053,7 @@ constexpr _Ret _Tuple_cat(index_sequence<_Kx...>, index_sequence<_Ix...>, _Ty _A return _Ret{_STD get<_Kx>(_STD get<_Ix>(_STD move(_Arg)))...}; } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 _EXPORT_STD template <_Tuple_like... _Tuples> #else // ^^^ C++23 / C++20 vvv _EXPORT_STD template @@ -1067,7 +1067,7 @@ _NODISCARD constexpr typename _Tuple_cat1<_Tuples...>::_Ret tuple_cat(_Tuples&&. } #if _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template #else // ^^^ C++23 / C++20 vvv template @@ -1077,7 +1077,7 @@ constexpr decltype(auto) _Apply_impl(_Callable&& _Obj, _Tuple&& _Tpl, index_sequ return _STD invoke(_STD forward<_Callable>(_Obj), _STD get<_Indices>(_STD forward<_Tuple>(_Tpl))...); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 _EXPORT_STD template #else // ^^^ C++23 / C++20 vvv _EXPORT_STD template @@ -1089,7 +1089,7 @@ constexpr decltype(auto) apply(_Callable&& _Obj, _Tuple&& _Tpl) noexcept( make_index_sequence>>{}); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template #else // ^^^ C++23 / C++20 vvv template @@ -1102,7 +1102,7 @@ constexpr _Ty _Make_from_tuple_impl(_Tuple&& _Tpl, index_sequence<_Indices...>) return _Ty(_STD get<_Indices>(_STD forward<_Tuple>(_Tpl))...); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 _EXPORT_STD template #else // ^^^ C++23 / C++20 vvv _EXPORT_STD template @@ -1118,7 +1118,7 @@ _NODISCARD constexpr _Ty make_from_tuple(_Tuple&& _Tpl) noexcept(noexcept(_Make_ template struct uses_allocator, _Alloc> : true_type {}; // true_type if container allocator enabled -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template <_Tuple_like _TTuple, _Tuple_like _UTuple, template class _TQual, template class _UQual, class _Indices = make_index_sequence>> struct _Tuple_like_common_reference; @@ -1164,7 +1164,7 @@ template <_Tuple_like _TTuple, _Tuple_like _UTuple> struct common_type<_TTuple, _UTuple> { using type = _Tuple_like_common_type<_TTuple, _UTuple>::type; }; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #if _HAS_TR1_NAMESPACE namespace _DEPRECATE_TR1_NAMESPACE tr1 { diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 2e67ff7b97..d636aa3d42 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -2231,7 +2231,7 @@ struct _Is_trivially_swappable : bool_constant<_Is_trivially_swappable_v<_Ty>> { // true_type if and only if it is valid to swap two _Ty lvalues by exchanging object representations. }; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 _EXPORT_STD template concept convertible_to = #if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-1627396 @@ -2259,7 +2259,7 @@ template class _TyQual, template { using type = common_reference_t>; }; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #define _BITMASK_OPS(_MAYBE_EXPORT, _BITMASK) \ _MAYBE_EXPORT _NODISCARD constexpr _BITMASK operator&(_BITMASK _Left, _BITMASK _Right) noexcept { \ diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index ae1560c4e8..0cb181592a 100644 --- a/stl/inc/unordered_map +++ b/stl/inc/unordered_map @@ -191,7 +191,7 @@ public: insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> unordered_map(from_range_t, _Rng&& _Range) : _Mybase(_Key_compare(), allocator_type()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -243,7 +243,7 @@ public: _Mybase::rehash(_Buckets); this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 unordered_map& operator=(const unordered_map& _Right) { _Mybase::operator=(_Right); @@ -501,7 +501,7 @@ template >, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_map<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Hasher = hash<_Range_key_type<_Rng>>, class _Keyeq = equal_to<_Range_key_type<_Rng>>, class _Alloc = allocator<_Range_to_alloc_type<_Rng>>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> @@ -520,7 +520,7 @@ template <_RANGES input_range _Rng, class _Hasher, class _Alloc, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> unordered_map(from_range_t, _Rng&&, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_map<_Range_key_type<_Rng>, _Range_mapped_type<_Rng>, _Hasher, equal_to<_Range_key_type<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template @@ -678,7 +678,7 @@ public: insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> unordered_multimap(from_range_t, _Rng&& _Range) : _Mybase(_Key_compare(), allocator_type()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -731,7 +731,7 @@ public: _Mybase::rehash(_Buckets); this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 unordered_multimap& operator=(const unordered_multimap& _Right) { _Mybase::operator=(_Right); @@ -871,7 +871,7 @@ template >, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_multimap<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Hasher = hash<_Range_key_type<_Rng>>, class _Keyeq = equal_to<_Range_key_type<_Rng>>, class _Alloc = allocator<_Range_to_alloc_type<_Rng>>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> @@ -892,7 +892,7 @@ template <_RANGES input_range _Rng, class _Hasher, class _Alloc, unordered_multimap(from_range_t, _Rng&&, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_multimap<_Range_key_type<_Rng>, _Range_mapped_type<_Rng>, _Hasher, equal_to<_Range_key_type<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template diff --git a/stl/inc/unordered_set b/stl/inc/unordered_set index be7caa0b28..72d5bfda78 100644 --- a/stl/inc/unordered_set +++ b/stl/inc/unordered_set @@ -186,7 +186,7 @@ public: this->insert(_First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> unordered_set(from_range_t, _Rng&& _Range) : _Mybase(_Key_compare(), allocator_type()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -238,7 +238,7 @@ public: _Mybase::rehash(_Buckets); this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 unordered_set& operator=(const unordered_set& _Right) { _Mybase::operator=(_Right); @@ -356,7 +356,7 @@ template , _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_set<_Kty, _Hasher, equal_to<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Hasher = hash<_RANGES range_value_t<_Rng>>, class _Keyeq = equal_to<_RANGES range_value_t<_Rng>>, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> @@ -375,7 +375,7 @@ template <_RANGES input_range _Rng, class _Hasher, class _Alloc, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> unordered_set(from_range_t, _Rng&&, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_set<_RANGES range_value_t<_Rng>, _Hasher, equal_to<_RANGES range_value_t<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template @@ -536,7 +536,7 @@ public: unordered_multiset(unordered_multiset&& _Right, const allocator_type& _Al) : _Mybase(_STD move(_Right), _Al) {} -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> unordered_multiset(from_range_t, _Rng&& _Range) : _Mybase(_Key_compare(), allocator_type()) { this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); @@ -589,7 +589,7 @@ public: _Mybase::rehash(_Buckets); this->_Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 unordered_multiset& operator=(unordered_multiset&& _Right) noexcept(_Alnode_traits::is_always_equal::value && is_nothrow_move_assignable_v<_Hasher> @@ -699,7 +699,7 @@ template , _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_multiset<_Kty, _Hasher, equal_to<_Kty>, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Hasher = hash<_RANGES range_value_t<_Rng>>, class _Keyeq = equal_to<_RANGES range_value_t<_Rng>>, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> @@ -719,7 +719,7 @@ template <_RANGES input_range _Rng, class _Hasher, class _Alloc, enable_if_t, _Is_allocator<_Alloc>>, int> = 0> unordered_multiset(from_range_t, _Rng&&, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_multiset<_RANGES range_value_t<_Rng>, _Hasher, equal_to<_RANGES range_value_t<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template diff --git a/stl/inc/utility b/stl/inc/utility index 74af596872..8a364def4d 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -10,9 +10,9 @@ #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_CXX20 #include @@ -185,7 +185,7 @@ _NODISCARD constexpr _Ty&& get(array<_Ty, _Size>&& _Arr) noexcept; _EXPORT_STD template _NODISCARD constexpr const _Ty&& get(const array<_Ty, _Size>&& _Arr) noexcept; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template concept _Different_from = !same_as, remove_cvref_t<_Ty2>>; @@ -216,7 +216,7 @@ concept _Can_construct_from_pair_like = _Pair_like<_PairLike> && !_Is_subrange_v && is_constructible_v<_Ty2, decltype(_STD get<1>(_STD declval<_PairLike>()))>; #endif // defined(__clang__) #endif // _HAS_CXX23 -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template struct pair { // store a pair of values @@ -288,8 +288,8 @@ struct pair { // store a pair of values && is_nothrow_constructible_v<_Ty2, const _Other2>) // strengthened : first(_STD forward(_Right.first)), second(_STD forward(_Right.second)) {} -#ifdef __cpp_lib_concepts -#ifdef __clang__ // TRANSITION, LLVM-59827 +#if _HAS_CXX20 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 (Clang), VSO-1900279 (EDG) template , int> = 0> #else // ^^^ workaround / no workaround vvv template <_Pair_like _Other> @@ -304,7 +304,7 @@ struct pair { // store a pair of values && is_nothrow_constructible_v<_Ty2, decltype(_STD get<1>(_STD declval<_Other>()))>) // strengthened : first(_STD get<0>(_STD forward<_Other>(_Right))), second(_STD get<1>(_STD forward<_Other>(_Right))) { } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 template @@ -417,7 +417,7 @@ struct pair { // store a pair of values return *this; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template <_Pair_like _Other> requires _Different_from<_Other, pair> && (!_Is_subrange_v>) && is_assignable_v<_Ty1&, decltype(_STD get<0>(_STD declval<_Other>()))> @@ -441,7 +441,7 @@ struct pair { // store a pair of values second = _STD get<1>(_STD forward<_Other>(_Right)); return *this; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX23 _CONSTEXPR20 void swap(pair& _Right) noexcept( @@ -494,7 +494,7 @@ _NODISCARD constexpr bool operator==(const pair<_Ty1, _Ty2>& _Left, const pair<_ return _Left.first == _Right.first && _Left.second == _Right.second; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Ty1, _Uty1>, _Synth_three_way_result<_Ty2, _Uty2>> @@ -504,7 +504,7 @@ _NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Ty1, } return _Synth_three_way{}(_Left.second, _Right.second); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv #if !_HAS_CXX20 template _NODISCARD constexpr bool operator!=(const pair<_Ty1, _Ty2>& _Left, const pair<_Uty1, _Uty2>& _Right) { @@ -531,9 +531,9 @@ template _NODISCARD constexpr bool operator>=(const pair<_Ty1, _Ty2>& _Left, const pair<_Uty1, _Uty2>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 template class _TQual, template class _UQual> requires requires { @@ -548,7 +548,7 @@ template struct common_type, pair<_Uty1, _Uty2>> { using type = pair, common_type_t<_Ty2, _Uty2>>; }; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template struct _Unrefwrap_helper { // leave unchanged if not a reference_wrapper diff --git a/stl/inc/variant b/stl/inc/variant index 071271d868..ea63c0bdd4 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1378,7 +1378,7 @@ _NODISCARD constexpr bool operator>=(const variant<_Types...>& _Left, const vari && _STD _Variant_raw_visit(_Right_offset - 1, _Right._Storage(), _Visitor{_Left._Storage()})); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template requires (three_way_comparable<_Types> && ...) _NODISCARD constexpr common_comparison_category_t...> @@ -1396,7 +1396,7 @@ _NODISCARD constexpr common_comparison_category_t inline constexpr size_t _Variant_total_states = diff --git a/stl/inc/vector b/stl/inc/vector index c703d95aca..d655209662 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -15,9 +15,9 @@ #include #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 #include <__msvc_formatter.hpp> -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -30,9 +30,9 @@ _STD_BEGIN template class _Vector_const_iterator : public _Iterator_base { public: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = typename _Myvec::value_type; using difference_type = typename _Myvec::difference_type; @@ -256,9 +256,9 @@ class _Vector_iterator : public _Vector_const_iterator<_Myvec> { public: using _Mybase = _Vector_const_iterator<_Myvec>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = typename _Myvec::value_type; using difference_type = typename _Myvec::difference_type; @@ -640,12 +640,12 @@ public: const auto _Length = static_cast(_STD distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); _Construct_n(_Count, _STD move(_UFirst), _STD move(_ULast)); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 } else if constexpr (forward_iterator<_Iter>) { const auto _Length = _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); _Construct_n(_Count, _STD move(_UFirst), _STD move(_ULast)); -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } else { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); @@ -663,7 +663,7 @@ public: _Construct_n(_Convert_size(_Ilist.size()), _Ilist.begin(), _Ilist.end()); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> constexpr vector(from_range_t, _Rng&& _Range, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { @@ -682,7 +682,7 @@ public: _Proxy._Release(); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 vector(const vector& _Right) : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { @@ -897,7 +897,7 @@ private: } } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template _CONSTEXPR20 void _Append_counted_range(_Iter _First, const size_type _Count) { // insert counted range _First + [0, _Count) at end @@ -954,10 +954,10 @@ private: _Orphan_range(_Oldlast, _Oldlast); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 public: -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> constexpr void append_range(_Rng&& _Range) { if constexpr (_RANGES forward_range<_Rng> || _RANGES sized_range<_Rng>) { @@ -968,7 +968,7 @@ public: _Append_uncounted_range(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template _CONSTEXPR20 iterator emplace(const_iterator _Where, _Valty&&... _Val) { @@ -1246,19 +1246,19 @@ public: const auto _Length = static_cast(_STD distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); _Insert_counted_range(_Where, _UFirst, _Count); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 } else if constexpr (forward_iterator<_Iter>) { const auto _Length = _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); _Insert_counted_range(_Where, _UFirst, _Count); -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } else { _Insert_uncounted_range(_Where, _UFirst, _ULast); } return _Make_iterator_offset(_Whereoff); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> constexpr iterator insert_range(const_iterator _Where, _Rng&& _Range) { const pointer _Whereptr = _Where._Ptr; @@ -1280,7 +1280,7 @@ public: } return _Make_iterator_offset(_Whereoff); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 iterator insert(const_iterator _Where, initializer_list<_Ty> _Ilist) { const pointer _Whereptr = _Where._Ptr; @@ -1455,18 +1455,18 @@ public: const auto _Length = static_cast(_STD distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); _Assign_counted_range(_UFirst, _Count); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 } else if constexpr (forward_iterator<_Iter>) { const auto _Length = _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); _Assign_counted_range(_UFirst, _Count); -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } else { _Assign_uncounted_range(_UFirst, _ULast); } } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Ty> _Rng> constexpr void assign_range(_Rng&& _Range) { if constexpr (_RANGES sized_range<_Rng> || _RANGES forward_range<_Rng>) { @@ -1477,7 +1477,7 @@ public: _Assign_uncounted_range(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 void assign(const initializer_list<_Ty> _Ilist) { const auto _Count = _Convert_size(_Ilist.size()); @@ -2219,11 +2219,11 @@ template >, vector(_Iter, _Iter, _Alloc = _Alloc()) -> vector<_Iter_value_t<_Iter>, _Alloc>; #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> vector(from_range_t, _Rng&&, _Alloc = _Alloc()) -> vector<_RANGES range_value_t<_Rng>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template class vector; @@ -2274,11 +2274,11 @@ struct _Vbase_compare_three_way { const _Vbase _Differing_bits = _Left ^ _Right; if (_Differing_bits == 0) { // improves _Countr_zero codegen below -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 return strong_ordering::equal; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv return 0; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ } const int _Bit_index = _Countr_zero(_Differing_bits); // number of least significant bits that match @@ -2287,15 +2287,15 @@ struct _Vbase_compare_three_way { const _Vbase _Mask = _Vbase{1} << _Bit_index; // selects the least significant bit that differs // Instead of comparing (_Left & _Mask) to (_Right & _Mask), we know that exactly one side will be zero. -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 return (_Left & _Mask) == 0 ? strong_ordering::less : strong_ordering::greater; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv return (_Left & _Mask) == 0 ? -1 : 1; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ } }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr _Synth_three_way_result<_Ty> operator<=>( const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _Alloc>& _Right) { @@ -2320,7 +2320,7 @@ _NODISCARD constexpr _Synth_three_way_result<_Ty> operator<=>( _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); } } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD _CONSTEXPR20 bool operator<(const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _Alloc>& _Right) { if constexpr (is_same_v<_Ty, bool>) { @@ -2362,7 +2362,7 @@ template _NODISCARD _CONSTEXPR20 bool operator>=(const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _Alloc>& _Right) { return !(_Left < _Right); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template _CONSTEXPR20 void swap(vector<_Ty, _Alloc>& _Left, vector<_Ty, _Alloc>& _Right) noexcept /* strengthened */ { @@ -2916,7 +2916,7 @@ public: insert(begin(), _First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> constexpr vector(from_range_t, _Rng&& _Range, const _Alloc& _Al = _Alloc()) : _Mybase(_Al) { if constexpr (_RANGES forward_range<_Rng> || _RANGES sized_range<_Rng>) { @@ -2927,7 +2927,7 @@ public: _Assign_uncounted_range(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 vector(vector&& _Right) noexcept : _Mybase(_STD move(_Right)) { this->_Swap_proxy_and_iterators(_Right); @@ -3253,12 +3253,12 @@ public: insert(end(), _Val); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> constexpr void append_range(_Rng&& _Range) { insert_range(end(), _STD forward<_Rng>(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 void pop_back() noexcept /* strengthened */ { erase(end() - 1); @@ -3270,7 +3270,7 @@ public: insert(begin(), _First, _Last); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template constexpr void _Assign_counted_range(_Iter _First, const size_type _Count) { _STL_INTERNAL_CHECK(this->_Myvec.empty()); @@ -3328,7 +3328,7 @@ public: _Assign_uncounted_range(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 void assign(_CRT_GUARDOVERFLOW size_type _Count, const bool& _Val) { clear(); @@ -3355,13 +3355,13 @@ public: const auto _Count = _Convert_size(_Length); const auto _Off = static_cast(_Insert_x(_Where, _Count)); _STD _Copy_unchecked(_UFirst, _ULast, begin() + _Off); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 } else if constexpr (forward_iterator<_Iter>) { const auto _Length = _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _Convert_size(_Length); const auto _Off = static_cast(_Insert_x(_Where, _Count)); _STD _Copy_unchecked(_UFirst, _ULast, begin() + _Off); -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } else { const auto _Old_size = this->_Mysize; for (; _UFirst != _ULast; ++_UFirst) { @@ -3376,7 +3376,7 @@ public: return begin() + _Saved_offset; } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> constexpr iterator insert_range(const_iterator _Where, _Rng&& _Range) { const difference_type _Old_off = _Where - begin(); @@ -3401,7 +3401,7 @@ public: return begin() + _Old_off; } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 iterator erase(const_iterator _Where_arg) noexcept /* strengthened */ { iterator _Where = _Make_iter(_Where_arg); @@ -3590,7 +3590,7 @@ namespace pmr { } // namespace pmr #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template requires _Is_specialization_v<_Ty, _Vb_reference> struct formatter<_Ty, _CharT> { @@ -3608,7 +3608,7 @@ public: return _Underlying.format(_Ref, _Ctx); } }; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template _INLINE_VAR constexpr bool _Is_vb_iterator<_Vb_iterator<_Alloc>, _RequiresMutable> = true; diff --git a/stl/inc/xhash b/stl/inc/xhash index 5a1fe9a406..b79a9a5fe5 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -958,12 +958,12 @@ public: _Insert_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> void insert_range(_Rng&& _Range) { _Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void insert(initializer_list _Ilist) { _Insert_range_unchecked(_Ilist.begin(), _Ilist.end()); diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 3235bd5702..b841597254 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -474,7 +474,7 @@ struct _Is_default_allocator, void_t::_Fr : is_same::_From_primary, allocator<_Ty>>::type {}; #if _HAS_CXX23 -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template concept _Has_member_allocate_at_least = requires(_Alloc& _Al, const _SizeTy& _Count) { _Al.allocate_at_least(_Count); }; #else // ^^^ no workaround / workaround vvv @@ -1650,7 +1650,7 @@ _CONSTEXPR20 _NoThrowFwdIt _Uninitialized_move_unchecked(_InIt _First, const _In return _Backout._Release(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template concept _No_throw_input_iterator = @@ -1782,7 +1782,7 @@ namespace ranges { } } } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template class _NODISCARD _Uninitialized_backout_al { @@ -1824,15 +1824,15 @@ _CONSTEXPR20 _Alloc_ptr_t<_Alloc> _Uninitialized_copy( // note: only called internally from elsewhere in the STL using _Ptrval = typename _Alloc::value_type*; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Unwrap_sent<_InIt>(_STD move(_Last)); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv // In pre-concepts world, _Uninitialized_copy should only ever be called with an iterator // and sentinel of the same type, so `_Get_unwrapped` is fine to call. auto _UFirst = _Get_unwrapped(_STD move(_First)); auto _ULast = _Get_unwrapped(_STD move(_Last)); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ constexpr bool _Can_memmove = _Sent_copy_cat::_Bitcopy_constructible && _Uses_default_construct<_Alloc, _Ptrval, decltype(*_UFirst)>::value; @@ -2362,7 +2362,7 @@ _NODISCARD constexpr auto uses_allocator_construction_args( const _Alloc& _Al, const pair<_Uty1, _Uty2>&& _Pair) noexcept; #endif // _HAS_CXX23 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 _EXPORT_STD template requires _Is_cv_pair<_Ty> && (_Pair_like<_Uty> || !_Is_deducible_as_pair<_Uty&>) #else // ^^^ C++23 with concepts / C++20 or no concepts vvv @@ -2453,7 +2453,7 @@ _NODISCARD constexpr auto uses_allocator_construction_args( } #endif // _HAS_CXX23 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 _EXPORT_STD template requires _Is_cv_pair<_Ty> && (_Pair_like<_Uty> || !_Is_deducible_as_pair<_Uty&>) #else // ^^^ C++23 with concepts / C++20 or no concepts vvv @@ -2461,7 +2461,7 @@ _EXPORT_STD template && !_Is_deducible_as_pair<_Uty&>, int> /* = 0 */> #endif // ^^^ C++20 or no concepts ^^^ _NODISCARD constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _Uty&& _Ux) noexcept { -#if _HAS_CXX23 && defined(__cpp_lib_concepts) +#if _HAS_CXX23 if constexpr (_Pair_like<_Uty> && !_Is_subrange_v>) { // equivalent to // return _STD uses_allocator_construction_args<_Ty>(_Al, piecewise_construct, @@ -2472,7 +2472,7 @@ _NODISCARD constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _U _STD uses_allocator_construction_args( _Al, _STD get<1>(_STD forward<_Uty>(_Ux)))); } else -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 { struct _Pair_remaker { const _Alloc& _Al; @@ -2524,7 +2524,7 @@ constexpr _Ty* uninitialized_construct_using_allocator(_Ty* _Ptr, const _Alloc& } #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 _EXPORT_STD struct from_range_t { explicit from_range_t() = default; }; @@ -2543,7 +2543,7 @@ using _Range_mapped_type = typename _RANGES range_value_t<_Rng>::second_type; // template <_RANGES input_range _Rng> using _Range_to_alloc_type = pair::first_type, typename _RANGES range_value_t<_Rng>::second_type>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template && !is_final_v<_Ty>> @@ -2610,10 +2610,10 @@ _INLINE_VAR constexpr bool _Is_transparent_v<_Ty, void_t struct _Is_transparent : bool_constant<_Is_transparent_v<_Ty>> {}; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 template concept _Transparent = _Is_transparent_v<_Ty>; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _NODISCARD _Elem* _UIntegral_to_buff(_Elem* _RNext, _UTy _UVal) { // used by both to_string and thread::id output diff --git a/stl/inc/xstring b/stl/inc/xstring index 6bc2b3d35c..e2fbb9e955 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -899,9 +899,9 @@ class basic_string_view; template class _String_view_iterator { public: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = typename _Traits::char_type; using difference_type = ptrdiff_t; @@ -1210,7 +1210,7 @@ public: #endif // _CONTAINER_DEBUG_LEVEL > 0 } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _Sent> requires (is_same_v, _Elem> && !is_convertible_v<_Sent, size_type>) constexpr basic_string_view(_Iter _First, _Sent _Last) noexcept(noexcept(_Last - _First)) // strengthened @@ -1232,7 +1232,7 @@ public: : _Mydata(_RANGES data(_Rng)), _Mysize(static_cast(_RANGES size(_Rng))) {} // clang-format on #endif // _HAS_CXX23 -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _NODISCARD constexpr const_iterator begin() const noexcept { #if _ITERATOR_DEBUG_LEVEL >= 1 @@ -1626,7 +1626,7 @@ private: #pragma warning(pop) -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _Sent> basic_string_view(_Iter, _Sent) -> basic_string_view>; @@ -1641,7 +1641,7 @@ namespace ranges { template inline constexpr bool enable_borrowed_range> = true; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD constexpr bool operator==( @@ -1837,9 +1837,9 @@ inline namespace literals { template class _String_const_iterator : public _Iterator_base { public: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = typename _Mystr::value_type; using difference_type = typename _Mystr::difference_type; @@ -2076,9 +2076,9 @@ class _String_iterator : public _String_const_iterator<_Mystr> { public: using _Mybase = _String_const_iterator<_Mystr>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = typename _Mystr::value_type; using difference_type = typename _Mystr::difference_type; @@ -2327,11 +2327,11 @@ struct _String_constructor_rvalue_allocator_tag { _Xlength_error("string too long"); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template concept _Contiguous_range_of = (_RANGES contiguous_range<_Rng>) &&same_as>, _Ty>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _EXPORT_STD template , class _Alloc = allocator<_Elem>> class basic_string { // null-terminated transparent array of elements @@ -2797,7 +2797,7 @@ private: } public: -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Elem> _Rng> constexpr basic_string(from_range_t, _Rng&& _Range, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { @@ -2813,7 +2813,7 @@ public: _Construct_from_iter(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 basic_string(basic_string&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { @@ -3368,7 +3368,7 @@ public: } } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Elem> _Rng> constexpr basic_string& append_range(_Rng&& _Range) { if constexpr (_RANGES sized_range<_Rng> && _Contiguous_range_of<_Rng, _Elem>) { @@ -3379,7 +3379,7 @@ public: return append(_Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 basic_string& assign(const basic_string& _Right) { *this = _Right; @@ -3474,7 +3474,7 @@ public: } } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Elem> _Rng> constexpr basic_string& assign_range(_Rng&& _Range) { if constexpr (_RANGES sized_range<_Rng> && _Contiguous_range_of<_Rng, _Elem>) { @@ -3491,7 +3491,7 @@ public: } } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 basic_string& insert(const size_type _Off, const basic_string& _Right) { // insert _Right at _Off @@ -3643,7 +3643,7 @@ public: return begin() + static_cast(_Off); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Elem> _Rng> constexpr iterator insert_range(const const_iterator _Where, _Rng&& _Range) { #if _ITERATOR_DEBUG_LEVEL != 0 @@ -3661,7 +3661,7 @@ public: return begin() + static_cast(_Off); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _CONSTEXPR20 basic_string& erase(const size_type _Off = 0) { // erase elements [_Off, ...) _Mypair._Myval2._Check_offset(_Off); @@ -3934,7 +3934,7 @@ public: } } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range<_Elem> _Rng> constexpr basic_string& replace_with_range(const const_iterator _First, const const_iterator _Last, _Rng&& _Range) { _Adl_verify_range(_First, _Last); @@ -3952,7 +3952,7 @@ public: return replace(_Off, _Length, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _NODISCARD _CONSTEXPR20 iterator begin() noexcept { return iterator(_Refancy(_Mypair._Myval2._Myptr()), _STD addressof(_Mypair._Myval2)); @@ -4916,12 +4916,12 @@ template , basic_string(basic_string_view<_Elem, _Traits>, _Guide_size_type_t<_Alloc>, _Guide_size_type_t<_Alloc>, const _Alloc& = _Alloc()) -> basic_string<_Elem, _Traits, _Alloc>; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> basic_string(from_range_t, _Rng&&, _Alloc = _Alloc()) -> basic_string<_RANGES range_value_t<_Rng>, char_traits<_RANGES range_value_t<_Rng>>, _Alloc>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _HAS_CXX17 _EXPORT_STD template diff --git a/stl/inc/xtree b/stl/inc/xtree index 099401a97d..a6e0689eee 100644 --- a/stl/inc/xtree +++ b/stl/inc/xtree @@ -1260,12 +1260,12 @@ public: _Insert_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Container_compatible_range _Rng> void insert_range(_Rng&& _Range) { _Insert_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void insert(initializer_list _Ilist) { _Insert_range_unchecked(_Ilist.begin(), _Ilist.end()); diff --git a/stl/inc/xutility b/stl/inc/xutility index d73982ea0d..0aead51f6e 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -311,7 +311,7 @@ struct pointer_traits<_Ty*> { }; #if _HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template concept _Has_to_address = requires(const _Ty& _Val) { typename pointer_traits<_Ty>; @@ -597,7 +597,7 @@ _INLINE_VAR constexpr bool _Has_unchecked_begin_end<_Ty, template using _Algorithm_int_t = conditional_t, _Ty, ptrdiff_t>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template concept _Destructible_object = is_object_v<_Ty> && destructible<_Ty>; @@ -1046,7 +1046,7 @@ using _Iter_value_t = iter_value_t<_Iter>; template using _Iter_diff_t = iter_difference_t<_Iter>; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template using _Iter_ref_t = typename iterator_traits<_Iter>::reference; @@ -1058,7 +1058,7 @@ using _Iter_diff_t = typename iterator_traits<_Iter>::difference_type; template using _Make_unsigned_like_t = make_unsigned_t<_Ty>; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ template using _Common_diff_t = common_type_t<_Iter_diff_t<_Iters>...>; @@ -1080,7 +1080,7 @@ _INLINE_VAR constexpr bool _Is_cpp17_input_iter_v = is_convertible_v<_Iter_cat_t template _INLINE_VAR constexpr bool _Is_ranges_input_iter_v = -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 (input_iterator<_Iter> && sentinel_for<_Iter, _Iter>) || #endif _Is_cpp17_input_iter_v<_Iter>; @@ -1090,7 +1090,7 @@ _INLINE_VAR constexpr bool _Is_cpp17_fwd_iter_v = is_convertible_v<_Iter_cat_t<_ template _INLINE_VAR constexpr bool _Is_ranges_fwd_iter_v = -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 forward_iterator<_Iter> || #endif _Is_cpp17_fwd_iter_v<_Iter>; @@ -1100,7 +1100,7 @@ _INLINE_VAR constexpr bool _Is_cpp17_bidi_iter_v = is_convertible_v<_Iter_cat_t< template _INLINE_VAR constexpr bool _Is_ranges_bidi_iter_v = -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 bidirectional_iterator<_Iter> || #endif _Is_cpp17_bidi_iter_v<_Iter>; @@ -1110,7 +1110,7 @@ _INLINE_VAR constexpr bool _Is_cpp17_random_iter_v = is_convertible_v<_Iter_cat_ template _INLINE_VAR constexpr bool _Is_ranges_random_iter_v = -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 random_access_iterator<_Iter> || #endif _Is_cpp17_random_iter_v<_Iter>; @@ -1498,14 +1498,14 @@ class reverse_iterator { public: using iterator_type = _BidIt; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = conditional_t, random_access_iterator_tag, bidirectional_iterator_tag>; using iterator_category = conditional_t, random_access_iterator_tag>, random_access_iterator_tag, _Iter_cat_t<_BidIt>>; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv using iterator_category = _Iter_cat_t<_BidIt>; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ using value_type = _Iter_value_t<_BidIt>; using difference_type = _Iter_diff_t<_BidIt>; using pointer = typename iterator_traits<_BidIt>::pointer; @@ -1521,19 +1521,19 @@ public: : current(_STD move(_Right)) {} template -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires (!is_same_v<_Other, _BidIt>) && convertible_to -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _CONSTEXPR17 reverse_iterator(const reverse_iterator<_Other>& _Right) noexcept( is_nothrow_constructible_v<_BidIt, const _Other&>) // strengthened : current(_Right.current) { } template -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires (!is_same_v<_Other, _BidIt>) && convertible_to && assignable_from<_BidIt&, const _Other&> -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _CONSTEXPR17 reverse_iterator& operator=(const reverse_iterator<_Other>& _Right) noexcept( is_nothrow_assignable_v<_BidIt&, const _Other&>) /* strengthened */ { current = _Right.current; @@ -1554,7 +1554,7 @@ public: noexcept(is_nothrow_copy_constructible_v<_BidIt> // && noexcept(--(_STD declval<_BidIt&>())) && _Has_nothrow_operator_arrow<_BidIt&, pointer>) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires (is_pointer_v<_BidIt> || requires(const _BidIt __i) { __i.operator->(); }) #endif { @@ -1618,7 +1618,7 @@ public: return current[static_cast(-_Off - 1)]; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD_FRIEND constexpr iter_rvalue_reference_t<_BidIt> iter_move(const reverse_iterator& _It) noexcept( is_nothrow_copy_constructible_v<_BidIt> // && noexcept(_RANGES iter_move(--_STD declval<_BidIt&>()))) { @@ -1638,7 +1638,7 @@ public: --_RTmp; _RANGES iter_swap(_LTmp, _RTmp); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using _Prevent_inheriting_unwrap = reverse_iterator; @@ -1684,11 +1684,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator==(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Get_current() == _Right._Get_current()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left._Get_current() == _Right._Get_current() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left._Get_current() == _Right._Get_current(); } @@ -1697,11 +1697,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator!=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Get_current() != _Right._Get_current()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left._Get_current() != _Right._Get_current() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left._Get_current() != _Right._Get_current(); } @@ -1710,11 +1710,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Get_current() > _Right._Get_current()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left._Get_current() > _Right._Get_current() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left._Get_current() > _Right._Get_current(); } @@ -1723,11 +1723,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Get_current() < _Right._Get_current()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left._Get_current() < _Right._Get_current() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left._Get_current() < _Right._Get_current(); } @@ -1736,11 +1736,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Get_current() >= _Right._Get_current()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left._Get_current() >= _Right._Get_current() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left._Get_current() >= _Right._Get_current(); } @@ -1749,23 +1749,23 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Get_current() <= _Right._Get_current()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left._Get_current() <= _Right._Get_current() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left._Get_current() <= _Right._Get_current(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _BidIt2> _NODISCARD constexpr compare_three_way_result_t<_BidIt1, _BidIt2> operator<=>(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_Right._Get_current() <=> _Left._Get_current())) /* strengthened */ { return _Right._Get_current() <=> _Left._Get_current(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR17 auto @@ -1787,11 +1787,11 @@ _NODISCARD _CONSTEXPR17 reverse_iterator<_BidIt> make_reverse_iterator(_BidIt _I return reverse_iterator<_BidIt>(_STD move(_Iter)); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template requires (!sized_sentinel_for<_BidIt1, _BidIt2>) inline constexpr bool disable_sized_sentinel_for, reverse_iterator<_BidIt2>> = true; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR17 auto begin(_Container& _Cont) noexcept(noexcept(_Cont.begin())) /* strengthened */ @@ -1962,7 +1962,7 @@ _NODISCARD constexpr const _Elem* data(initializer_list<_Elem> _Ilist) noexcept return _Ilist.begin(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #if _HAS_CXX23 _EXPORT_STD template using iter_const_reference_t = common_reference_t&&, iter_reference_t<_Ty>>; @@ -3939,14 +3939,14 @@ namespace ranges { _EXPORT_STD template using borrowed_subrange_t = conditional_t, subrange>, dangling>; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 struct _Container_proxy; struct _Iterator_base12; struct _Default_sentinel {}; // empty struct to serve as the end of a range -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template class move_sentinel; @@ -3974,7 +3974,7 @@ public: using difference_type = _Iter_diff_t<_Iter>; using pointer = _Iter; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 private: static constexpr auto _Get_iter_concept() { if constexpr (random_access_iterator<_Iter>) { @@ -3992,10 +3992,10 @@ public: using iterator_concept = decltype(_Get_iter_concept()); using reference = iter_rvalue_reference_t<_Iter>; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv using reference = conditional_t>, remove_reference_t<_Iter_ref_t<_Iter>>&&, _Iter_ref_t<_Iter>>; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _CONSTEXPR17 move_iterator() = default; @@ -4003,49 +4003,49 @@ public: : _Current(_STD move(_Right)) {} template -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires (!is_same_v<_Other, _Iter>) && convertible_to -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _CONSTEXPR17 move_iterator(const move_iterator<_Other>& _Right) noexcept( is_nothrow_constructible_v<_Iter, const _Other&>) // strengthened : _Current(_Right.base()) { } template -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires (!is_same_v<_Other, _Iter>) && convertible_to && assignable_from<_Iter&, const _Other&> -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _CONSTEXPR17 move_iterator& operator=(const move_iterator<_Other>& _Right) noexcept( is_nothrow_assignable_v<_Iter&, const _Other&>) /* strengthened */ { _Current = _Right.base(); return *this; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD constexpr const iterator_type& base() const& noexcept { return _Current; } _NODISCARD constexpr iterator_type base() && noexcept(is_nothrow_move_constructible_v<_Iter>) /* strengthened */ { return _STD move(_Current); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD _CONSTEXPR17 iterator_type base() const noexcept(is_nothrow_copy_constructible_v<_Iter>) /* strengthened */ { return _Current; } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _NODISCARD _CONSTEXPR17 reference operator*() const -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 noexcept(noexcept(_RANGES iter_move(_Current))) /* strengthened */ { return _RANGES iter_move(_Current); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv noexcept(noexcept(static_cast(*_Current))) /* strengthened */ { return static_cast(*_Current); } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _CXX20_DEPRECATE_MOVE_ITERATOR_ARROW _NODISCARD _CONSTEXPR17 pointer operator->() const noexcept(is_nothrow_copy_constructible_v<_Iter>) /* strengthened */ { @@ -4059,17 +4059,17 @@ public: _CONSTEXPR17 auto operator++(int) noexcept(is_nothrow_copy_constructible_v<_Iter> // && noexcept(++_Current)) /* strengthened */ { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 if constexpr (forward_iterator<_Iter>) { -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 move_iterator _Tmp = *this; ++_Current; return _Tmp; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 } else { ++_Current; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } _CONSTEXPR17 move_iterator& operator--() noexcept(noexcept(--_Current)) /* strengthened */ { @@ -4119,16 +4119,16 @@ public: } _NODISCARD _CONSTEXPR17 reference operator[](const difference_type _Off) const -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 noexcept(noexcept(_RANGES iter_move(_Current + _Off))) /* strengthened */ { return _RANGES iter_move(_Current + _Off); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv noexcept(noexcept(_STD move(_Current[_Off]))) /* strengthened */ { return _STD move(_Current[_Off]); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _Sent> _NODISCARD_FRIEND constexpr bool operator==(const move_iterator& _Left, const move_sentinel<_Sent>& _Right) noexcept( @@ -4158,18 +4158,18 @@ public: noexcept(_RANGES iter_swap(_Left._Current, _Right.base()))) { _RANGES iter_swap(_Left._Current, _Right.base()); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template , int> = 0> friend constexpr void _Verify_range(const move_iterator& _First, const move_iterator<_Iter2>& _Last) noexcept { _Verify_range(_First._Current, _Last._Get_current()); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template _Sent, enable_if_t<_Range_verifiable_v<_Iter, _Sent>, int> = 0> friend constexpr void _Verify_range(const move_iterator& _First, const move_sentinel<_Sent>& _Last) noexcept { _Verify_range(_First._Current, _Last._Get_last()); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using _Prevent_inheriting_unwrap = move_iterator; @@ -4216,11 +4216,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator==(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left.base() == _Right.base()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left.base() == _Right.base() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left.base() == _Right.base(); } @@ -4237,11 +4237,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept( noexcept(_Fake_copy_init(_Left.base() < _Right.base()))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Left.base() < _Right.base() } -> _Implicitly_convertible_to; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Left.base() < _Right.base(); } @@ -4249,9 +4249,9 @@ _NODISCARD _CONSTEXPR17 bool _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Right < _Left)) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { _Right < _Left; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Right < _Left; } @@ -4259,9 +4259,9 @@ _NODISCARD _CONSTEXPR17 bool operator>(const move_iterator<_Iter1>& _Left, _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<=(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Right < _Left)) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { _Right < _Left; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return !(_Right < _Left); } @@ -4269,20 +4269,20 @@ _NODISCARD _CONSTEXPR17 bool operator<=(const move_iterator<_Iter1>& _Left, _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>=(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Left < _Right)) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { _Left < _Right; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return !(_Left < _Right); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _EXPORT_STD template _Iter2> _NODISCARD constexpr compare_three_way_result_t<_Iter1, _Iter2> operator<=>(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Left.base() <=> _Right.base())) /* strengthened */ { return _Left.base() <=> _Right.base(); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR17 auto operator-(const move_iterator<_Iter1>& _Left, @@ -4295,11 +4295,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 move_iterator<_Iter> operator+(typename move_iterator<_Iter>::difference_type _Off, const move_iterator<_Iter>& _Right) noexcept( noexcept(move_iterator<_Iter>(_Right.base() + _Off))) /* strengthened */ -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 requires requires { { _Right.base() + _Off } -> same_as<_Iter>; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return move_iterator<_Iter>(_Right.base() + _Off); } @@ -4310,7 +4310,7 @@ _NODISCARD _CONSTEXPR17 move_iterator<_Iter> make_move_iterator(_Iter _It) noexc return move_iterator<_Iter>(_STD move(_It)); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template requires (!sized_sentinel_for<_Iter1, _Iter2>) inline constexpr bool disable_sized_sentinel_for, move_iterator<_Iter2>> = true; @@ -4327,12 +4327,12 @@ namespace _Unreachable_sentinel_detail { _EXPORT_STD struct unreachable_sentinel_t : _Unreachable_sentinel_detail::_Base {}; // TRANSITION, /permissive- _EXPORT_STD inline constexpr unreachable_sentinel_t unreachable_sentinel{}; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 // _Iterator_is_contiguous<_Iter> reports whether an iterator is known to be contiguous. // (Without concepts, this detection is limited, which will limit when we can activate optimizations.) -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // When concepts are available, we can detect arbitrary contiguous iterators. template inline constexpr bool _Iterator_is_contiguous = contiguous_iterator<_Iter>; @@ -4342,7 +4342,7 @@ _NODISCARD constexpr auto _To_address(const _Iter& _Val) noexcept { _STL_INTERNAL_STATIC_ASSERT(contiguous_iterator<_Iter>); return _STD to_address(_Val); } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv // When concepts aren't available, we can detect pointers. (Iterators should be unwrapped before using this.) template _INLINE_VAR constexpr bool _Iterator_is_contiguous = is_pointer_v<_Iter>; @@ -4352,7 +4352,7 @@ _NODISCARD constexpr auto _To_address(const _Iter& _Val) noexcept { _STL_INTERNAL_STATIC_ASSERT(is_pointer_v<_Iter>); return _Val; } -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ template _NODISCARD constexpr auto _To_address(const move_iterator<_Iter>& _Val) noexcept { @@ -4441,9 +4441,9 @@ template _CONSTEXPR20 void _Verify_ranges_do_not_overlap(const _Iter1& _First1, const _Sent1& _Last1, const _Iter2& _First2) { #if _ITERATOR_DEBUG_LEVEL == 2 if constexpr (_Iterators_are_contiguous<_Iter1, _Iter2> -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 && sized_sentinel_for<_Sent1, _Iter1> -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 ) { #if _HAS_CXX20 if (_STD is_constant_evaluated()) { @@ -4515,9 +4515,9 @@ template _CONSTEXPR20 _OutIt _Copy_n_unchecked4(_InIt _First, _SizeTy _Count, _OutIt _Dest) { // copy _First + [0, _Count) to _Dest + [0, _Count), returning _Dest + _Count // note: has callers outside the copy family -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _STL_INTERNAL_STATIC_ASSERT(_Integer_like<_SizeTy>); -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 if constexpr (_Iter_copy_cat<_InIt, _OutIt>::_Bitcopy_assignable) { #if _HAS_CXX20 @@ -4537,7 +4537,7 @@ _CONSTEXPR20 _OutIt _Copy_n_unchecked4(_InIt _First, _SizeTy _Count, _OutIt _Des template using _Sent_copy_cat = conditional_t< -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 is_same_v<_Sent, _InIt> || sized_sentinel_for<_Sent, _InIt>, #else // ^^^ Concepts support / no Concepts vvv is_same_v<_Sent, _InIt>, @@ -4556,11 +4556,11 @@ _CONSTEXPR20 _OutIt _Copy_unchecked(_InIt _First, _Sent _Last, _OutIt _Dest) { if (!_STD is_constant_evaluated()) #endif // _HAS_CXX20 { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 if constexpr (!is_same_v<_InIt, _Sent>) { return _Copy_memmove_n(_First, static_cast(_Last - _First), _Dest); } else -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _Copy_memmove(_First, _Last, _Dest); } @@ -4596,7 +4596,7 @@ _FwdIt2 copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest) noexcept /* } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template concept _Convertible_from = convertible_to<_From, _To>; @@ -4738,7 +4738,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Copy_fn copy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _OutIt copy_n(_InIt _First, _Diff _Count_raw, _OutIt _Dest) { @@ -5082,7 +5082,7 @@ _FwdIt fill_n(_ExPo&&, _FwdIt _Dest, _Diff _Count_raw, const _Ty& _Val) noexcept } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Fill_n_fn { public: @@ -5117,7 +5117,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Fill_n_fn fill_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _INLINE_VAR constexpr bool _Can_compare_with_operator_equal = false; @@ -5181,12 +5181,12 @@ template _INLINE_VAR constexpr bool _Can_memcmp_elements_with_pred<_Elem1, _Elem2, equal_to<>> = _Can_memcmp_elements<_Elem1, _Elem2>; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // ranges::equal_to is also transparent. template _INLINE_VAR constexpr bool _Can_memcmp_elements_with_pred<_Elem1, _Elem2, _RANGES equal_to> = _Can_memcmp_elements<_Elem1, _Elem2>; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 // _Equal_memcmp_is_safe<_Iter1, _Iter2, _Pr> reports whether we can activate the memcmp optimization // for arbitrary iterators and predicates. @@ -5321,7 +5321,7 @@ _NODISCARD bool equal(_ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1 } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _NODISCARD constexpr iterator_t<_Rng> _Rewrap_iterator(_Rng&& _Range, _It&& _Val) { @@ -5452,7 +5452,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Mismatch_fn mismatch; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template _INLINE_VAR constexpr bool _Lex_compare_memcmp_classify_elements = conjunction_v<_Is_character_or_bool<_Elem1>, @@ -5494,7 +5494,7 @@ struct _Lex_compare_memcmp_classify_pred<_Elem1, _Elem2, greater<>> { using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem1, _Elem2>, greater, void>; }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template struct _Lex_compare_memcmp_classify_pred<_Elem1, _Elem2, _RANGES less> { using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem1, _Elem2>, less, void>; @@ -5504,7 +5504,7 @@ template struct _Lex_compare_memcmp_classify_pred<_Elem1, _Elem2, _RANGES greater> { using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem1, _Elem2>, greater, void>; }; -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template using _Lex_compare_memcmp_classify = @@ -5575,7 +5575,7 @@ _NODISCARD bool lexicographical_compare(_ExPo&&, const _FwdIt1 _First1, const _F } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template struct _Lex_compare_three_way_memcmp_classify_comp { using _Comp = void; @@ -5662,7 +5662,7 @@ _NODISCARD constexpr auto lexicographical_compare_three_way( const _InIt1 _First1, const _InIt1 _Last1, const _InIt2 _First2, const _InIt2 _Last2) { return _STD lexicographical_compare_three_way(_First1, _Last1, _First2, _Last2, compare_three_way{}); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template struct _Vector_alg_in_find_is_safe_object_pointers : false_type {}; @@ -5817,7 +5817,7 @@ _EXPORT_STD template concept _Sized_or_unreachable_sentinel_for = sized_sentinel_for<_Se, _It> || same_as<_Se, unreachable_sentinel_t>; @@ -5926,7 +5926,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Find_fn find; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _Iter_diff_t<_InIt> count(const _InIt _First, const _InIt _Last, const _Ty& _Val) { @@ -6275,7 +6275,7 @@ _NODISCARD _CONSTEXPR20 _InIt find_if(_InIt _First, const _InIt _Last, _Pr _Pred return _First; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _NODISCARD constexpr _Result _Rewrap_subrange(_Wrapped& _Val, subrange<_Unwrapped>&& _UResult) { @@ -6576,7 +6576,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Search_fn search; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template > _INLINE_VAR constexpr bool _Is_min_max_optimization_safe = // Activate the vector algorithms for min_/max_element? @@ -6584,9 +6584,9 @@ _INLINE_VAR constexpr bool _Is_min_max_optimization_safe = // Activate the vecto && !_Iterator_is_volatile<_Iter> // The iterator must not be volatile. && conjunction_v, is_pointer<_Elem>>, // Element is of integral or pointer type. disjunction< // And either of the following: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 is_same<_Pr, _RANGES less>, // predicate is ranges::less -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 is_same<_Pr, less<>>, is_same<_Pr, less<_Elem>>>>; // predicate is less template @@ -6647,7 +6647,7 @@ _NODISCARD _FwdIt max_element(_ExPo&&, _FwdIt _First, _FwdIt _Last) noexcept /* return _STD max_element(_First, _Last); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _NODISCARD constexpr _It _Max_element_unchecked(_It _First, const _Se _Last, _Pr _Pred, _Pj _Proj) { @@ -6708,7 +6708,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Max_element_fn max_element; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -6724,7 +6724,7 @@ _NODISCARD constexpr _Ty(max)(initializer_list<_Ty> _Ilist) { return (_STD max)(_Ilist, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template concept _Prefer_iterator_copies = // When we have a choice, should we copy iterators or copy elements? @@ -6781,7 +6781,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Max_fn max; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template constexpr _FwdIt _Min_element_unchecked(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { // find smallest element @@ -6841,7 +6841,7 @@ _NODISCARD _FwdIt min_element(_ExPo&&, _FwdIt _First, _FwdIt _Last) noexcept /* return _STD min_element(_First, _Last); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template _NODISCARD constexpr _It _Min_element_unchecked(_It _First, const _Se _Last, _Pr _Pred, _Pj _Proj) { @@ -6902,7 +6902,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Min_element_fn min_element; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 _EXPORT_STD template @@ -6918,7 +6918,7 @@ _NODISCARD constexpr _Ty(min)(initializer_list<_Ty> _Ilist) { return (_STD min)(_Ilist, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Min_fn { public: @@ -6969,7 +6969,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Min_fn min; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt lower_bound(_FwdIt _First, const _FwdIt _Last, const _Ty& _Val, _Pr _Pred) { @@ -7126,7 +7126,7 @@ _NODISCARD constexpr bool _Is_finite(const _Ty _Xx) noexcept { // constexpr isfi _EXPORT_STD struct monostate {}; #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template <_Integer_like _Int> _NODISCARD constexpr bool _Add_overflow(const _Int _Left, const _Int _Right, _Int& _Out) { #ifdef __clang__ @@ -7196,7 +7196,7 @@ _NODISCARD constexpr bool _Mul_overflow(const _Int _Left, const _Int _Right, _In } } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 _STD_END diff --git a/tests/std/include/test_min_max_element_support.hpp b/tests/std/include/test_min_max_element_support.hpp index 2d764b3dbf..9ade4d6b89 100644 --- a/tests/std/include/test_min_max_element_support.hpp +++ b/tests/std/include/test_min_max_element_support.hpp @@ -9,7 +9,7 @@ #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include #endif @@ -90,7 +90,7 @@ void test_case_min_max_element(const std::vector& input) { assert(expected_min == actual_min); assert(expected_max == actual_max); assert(expected_minmax == actual_minmax); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using std::ranges::views::take, std::ptrdiff_t; auto actual_min_range = std::ranges::min_element(input); @@ -107,5 +107,5 @@ void test_case_min_max_element(const std::vector& input) { assert(expected_max == actual_max_sized_range); assert(expected_minmax.first == actual_minmax_sized_range.min); assert(expected_minmax.second == actual_minmax_sized_range.max); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } diff --git a/tests/std/tests/Dev10_709166_checked_and_unchecked_array_iterator/test.cpp b/tests/std/tests/Dev10_709166_checked_and_unchecked_array_iterator/test.cpp index a1f8f5b611..a84ae56e1d 100644 --- a/tests/std/tests/Dev10_709166_checked_and_unchecked_array_iterator/test.cpp +++ b/tests/std/tests/Dev10_709166_checked_and_unchecked_array_iterator/test.cpp @@ -30,12 +30,12 @@ void check_checked_array_iterator_category_and_convertibility() { STATIC_ASSERT(std::is_convertible_v, stdext::checked_array_iterator>); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 STATIC_ASSERT( std::is_same_v::iterator_concept, std::contiguous_iterator_tag>); STATIC_ASSERT(std::contiguous_iterator>); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } template @@ -54,12 +54,12 @@ void check_unchecked_array_iterator_category_and_convertibility() { STATIC_ASSERT( std::is_convertible_v, stdext::unchecked_array_iterator>); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 STATIC_ASSERT( std::is_same_v::iterator_concept, std::contiguous_iterator_tag>); STATIC_ASSERT(std::contiguous_iterator>); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } int main() { diff --git a/tests/std/tests/Dev11_0135139_vector_bool_comparisons/test.cpp b/tests/std/tests/Dev11_0135139_vector_bool_comparisons/test.cpp index 4492721074..377d783dd3 100644 --- a/tests/std/tests/Dev11_0135139_vector_bool_comparisons/test.cpp +++ b/tests/std/tests/Dev11_0135139_vector_bool_comparisons/test.cpp @@ -30,10 +30,10 @@ void test_comparison(const char* const left_str, const char* const right_str, co const auto left = vb_from_str(left_str); const auto right = vb_from_str(right_str); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 assert((left <=> right) == (static_cast(order) <=> 0)); assert((right <=> left) == (0 <=> static_cast(order))); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 switch (order) { case Lt: diff --git a/tests/std/tests/Dev11_0316853_find_memchr_optimization/test.cpp b/tests/std/tests/Dev11_0316853_find_memchr_optimization/test.cpp index 28af703f5d..5ec9aaf944 100644 --- a/tests/std/tests/Dev11_0316853_find_memchr_optimization/test.cpp +++ b/tests/std/tests/Dev11_0316853_find_memchr_optimization/test.cpp @@ -164,9 +164,9 @@ int main() { v.push_back(44); v.push_back(55); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(_Vector_alg_in_find_is_safe, "should optimize"); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 static_assert(_Could_compare_equal_to_value_type(33), "should be within limits"); assert(find(v.begin(), v.end(), 33) - v.begin() == 1); @@ -226,9 +226,9 @@ int main() { v.push_back(0x11223344UL); v.push_back(0xAABBCCDDUL); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(_Vector_alg_in_find_is_safe, "should optimize"); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 // Make sure we don't look for 0x11 bytes in the range! @@ -265,9 +265,9 @@ int main() { vc.push_back('o'); vc.push_back('w'); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(_Vector_alg_in_find_is_safe, "should optimize"); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 assert(find(vc.begin(), vc.end(), 'o') == vc.begin() + 3); assert(find(vc.begin(), vc.end(), 'X') == vc.end()); @@ -290,9 +290,9 @@ int main() { vsc.push_back(-128); vsc.push_back(127); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(_Vector_alg_in_find_is_safe, "should optimize"); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 assert(find(vsc.begin(), vsc.end(), 17) == vsc.begin()); assert(find(vsc.begin(), vsc.end(), 29) == vsc.begin() + 1); @@ -317,9 +317,9 @@ int main() { vuc.push_back(254); vuc.push_back(255); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(_Vector_alg_in_find_is_safe, "should optimize"); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 assert(find(vuc.begin(), vuc.end(), 47) == vuc.begin() + 2); assert(find(vuc.begin(), vuc.end(), 255) == vuc.begin() + 4); diff --git a/tests/std/tests/GH_000431_copy_move_family/test.cpp b/tests/std/tests/GH_000431_copy_move_family/test.cpp index 9b7cf5ab6e..fe0b36682a 100644 --- a/tests/std/tests/GH_000431_copy_move_family/test.cpp +++ b/tests/std/tests/GH_000431_copy_move_family/test.cpp @@ -657,7 +657,7 @@ int main() { test_algorithms([](auto begin, auto end, auto out) { uninitialized_move_n(begin, distance(begin, end), out); }); #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 test_algorithms([](auto begin, auto end, auto out) { ranges::copy(begin, end, out); }); test_algorithms([](auto begin, auto end, auto out) { ranges::copy_n(begin, distance(begin, end), out); }); test_algorithms([](auto begin, auto end, auto out) { @@ -710,5 +710,5 @@ int main() { test_algorithms([](auto begin, auto end, auto out) { ranges::uninitialized_move_n(begin, distance(begin, end), out, unreachable_sentinel); }); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } diff --git a/tests/std/tests/GH_000431_equal_family/test.cpp b/tests/std/tests/GH_000431_equal_family/test.cpp index 9bd78f6bb3..9fc3827c75 100644 --- a/tests/std/tests/GH_000431_equal_family/test.cpp +++ b/tests/std/tests/GH_000431_equal_family/test.cpp @@ -720,14 +720,14 @@ int main() { return equal(begin1, end1, begin2, end2, pred); }); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 test_algorithms([](auto begin1, auto end1, auto begin2, auto end2, auto pred) { return ranges::equal(begin1, end1, begin2, end2, pred); }); #endif // test_algorithms } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // Also test GH-1523, in which std::equal didn't properly convert non-pointer contiguous iterators to pointers. struct gh1523_iter { // a contiguous_iterator that doesn't unwrap into a pointer @@ -792,4 +792,4 @@ void test_gh_1523() { // COMPILE-ONLY // GH-1523 Some StdLib algorithms fail /std:c++latest compilation with custom contiguous iterators (void) equal(gh1523_iter{}, gh1523_iter{}, gh1523_iter{}, gh1523_iter{}); } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 diff --git a/tests/std/tests/GH_000431_equal_memcmp_is_safe/test.compile.pass.cpp b/tests/std/tests/GH_000431_equal_memcmp_is_safe/test.compile.pass.cpp index 560f081613..efbe45e9f5 100644 --- a/tests/std/tests/GH_000431_equal_memcmp_is_safe/test.compile.pass.cpp +++ b/tests/std/tests/GH_000431_equal_memcmp_is_safe/test.compile.pass.cpp @@ -64,10 +64,10 @@ template STATIC_ASSERT(test_equal_memcmp_is_safe_for_pred>()); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 STATIC_ASSERT(test_equal_memcmp_is_safe_for_pred()); STATIC_ASSERT(test_equal_memcmp_is_safe_for_pred()); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 #if _HAS_CXX17 auto lambda = [](auto&&, auto&&) { return false; }; @@ -510,20 +510,20 @@ STATIC_ASSERT(test_equal_memcmp_is_safe_for_pred>>()); // Test different containers -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, vector>()); STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, array>()); STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, array>()); STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, vector>()); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, list>()); STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, list>()); STATIC_ASSERT(test_equal_memcmp_is_safe_for_containers, vector>()); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // Test counted_iterator STATIC_ASSERT(assert_equal_memcmp_is_safe, int*>()); STATIC_ASSERT(assert_equal_memcmp_is_safe>()); STATIC_ASSERT(assert_equal_memcmp_is_safe, counted_iterator>()); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 diff --git a/tests/std/tests/GH_000431_iter_copy_move_cat/test.compile.pass.cpp b/tests/std/tests/GH_000431_iter_copy_move_cat/test.compile.pass.cpp index e82adc5789..cac035a3e9 100644 --- a/tests/std/tests/GH_000431_iter_copy_move_cat/test.compile.pass.cpp +++ b/tests/std/tests/GH_000431_iter_copy_move_cat/test.compile.pass.cpp @@ -456,12 +456,12 @@ void iter_cat_test_cases() { test_iter_cat_for_types(); // Test different containers -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 test_iter_cat_for_containers, vector>(); test_iter_cat_for_containers, array>(); test_iter_cat_for_containers, array>(); test_iter_cat_for_containers, vector>(); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 test_iter_cat_for_containers, list>(); test_iter_cat_for_containers, list>(); @@ -470,12 +470,12 @@ void iter_cat_test_cases() { // Test double move_iterator test_iter_cat, int*>(); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // Test counted_iterator test_iter_cat, int*>(); test_iter_cat>(); test_iter_cat, counted_iterator>(); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 // No volatile test_iter_cat_for_trivially_copyable_types(); diff --git a/tests/std/tests/GH_000431_lex_compare_family/test.cpp b/tests/std/tests/GH_000431_lex_compare_family/test.cpp index ee47a0f7bb..b8017b70fe 100644 --- a/tests/std/tests/GH_000431_lex_compare_family/test.cpp +++ b/tests/std/tests/GH_000431_lex_compare_family/test.cpp @@ -11,9 +11,9 @@ #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 #pragma warning(disable : 4018) // '<': signed/unsigned mismatch #pragma warning(disable : 4365) // conversion from 'X' to 'Y', signed/unsigned mismatch @@ -375,7 +375,7 @@ void test_algorithms(LexCompareFn lex_compare_fn) { } } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template void test_three_way_algorithms_for_integrals( LexCompareThreeWayFn lex_compare_three_way_fn, Comp comp = compare_three_way{}) { @@ -532,14 +532,14 @@ void test_three_way_algorithms(LexCompareThreeWayFn lex_compare_three_way_fn) { test_three_way_algorithms_for_bools(lex_compare_three_way_fn); } } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 int main() { test_algorithms([](auto begin1, auto end1, auto begin2, auto end2, auto pred) { return lexicographical_compare(begin1, end1, begin2, end2, pred); }); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 test_algorithms([](auto begin1, auto end1, auto begin2, auto end2, auto pred) { return ranges::lexicographical_compare(begin1, end1, begin2, end2, pred); }); @@ -555,5 +555,5 @@ int main() { test_three_way_algorithms([](auto begin1, auto end1, auto begin2, auto end2, auto comp) { return lexicographical_compare_three_way(begin1, end1, begin2, end2, comp); }); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } diff --git a/tests/std/tests/GH_000431_lex_compare_memcmp_classify/test.compile.pass.cpp b/tests/std/tests/GH_000431_lex_compare_memcmp_classify/test.compile.pass.cpp index 2d0e1b7717..94d1542a68 100644 --- a/tests/std/tests/GH_000431_lex_compare_memcmp_classify/test.compile.pass.cpp +++ b/tests/std/tests/GH_000431_lex_compare_memcmp_classify/test.compile.pass.cpp @@ -12,9 +12,9 @@ #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 using namespace std; @@ -25,12 +25,12 @@ void assert_lex_compare_memcmp_classify() { STATIC_ASSERT(is_same_v<_Lex_compare_memcmp_classify, Expected>); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template void assert_lex_compare_three_way_memcmp_classify() { STATIC_ASSERT(is_same_v<_Lex_compare_three_way_memcmp_classify, Expected>); } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 template void test_lex_compare_memcmp_classify_for_iterators() { @@ -40,7 +40,7 @@ void test_lex_compare_memcmp_classify_for_iterators() { assert_lex_compare_memcmp_classify(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template void test_lex_compare_three_way_memcmp_classify_for_iterators() { assert_lex_compare_three_way_memcmp_classify(); @@ -48,27 +48,27 @@ void test_lex_compare_three_way_memcmp_classify_for_iterators() { assert_lex_compare_three_way_memcmp_classify(); assert_lex_compare_three_way_memcmp_classify(); } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 template void test_lex_compare_memcmp_classify_for_pred_helper() { test_lex_compare_memcmp_classify_for_iterators(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template void test_lex_compare_three_way_memcmp_classify_for_comp_helper() { test_lex_compare_three_way_memcmp_classify_for_iterators(); } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 template void test_lex_compare_memcmp_classify_for_pred() { test_lex_compare_memcmp_classify_for_pred_helper(); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 template void test_lex_compare_three_way_memcmp_classify_for_comp() { test_lex_compare_three_way_memcmp_classify_for_comp_helper(); @@ -78,7 +78,7 @@ void test_lex_compare_three_way_memcmp_classify_for_comp() { test_lex_compare_three_way_memcmp_classify_for_comp_helper(); test_lex_compare_three_way_memcmp_classify_for_comp_helper(); } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 template void test_lex_compare_memcmp_classify_for_opaque_preds_helper() { @@ -145,7 +145,7 @@ void test_lex_compare_memcmp_classify_for_types() { auto lambda = [](auto&&, auto&&) { return false; }; test_lex_compare_memcmp_classify_for_pred(); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 test_lex_compare_memcmp_classify_for_pred(); test_lex_compare_memcmp_classify_for_pred(); @@ -173,7 +173,7 @@ void test_lex_compare_memcmp_classify_for_types() { auto three_way_lambda = [](auto&&, auto&&) { return strong_ordering::equal; }; test_lex_compare_memcmp_classify_for_pred(); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } template @@ -303,24 +303,24 @@ void lex_compare_memcmp_classify_test_cases() { test_lex_compare_memcmp_classify_for_pred>>(); // Test different containers -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 test_lex_compare_memcmp_classify_for_containers, vector>(); test_lex_compare_memcmp_classify_for_containers, array>(); test_lex_compare_memcmp_classify_for_containers, array>(); test_lex_compare_memcmp_classify_for_containers, array>(); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 test_lex_compare_memcmp_classify_for_containers, list>(); test_lex_compare_memcmp_classify_for_containers, list>(); test_lex_compare_memcmp_classify_for_containers, vector>(); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // Test counted_iterator assert_lex_compare_memcmp_classify, counted_iterator, unsigned char*, less<>>(); assert_lex_compare_memcmp_classify, unsigned char*, counted_iterator, less<>>(); assert_lex_compare_memcmp_classify, counted_iterator, counted_iterator, less<>>(); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 // No volatile test_lex_compare_memcmp_classify_for_pred_helper>(); diff --git a/tests/std/tests/GH_000545_include_compare/test_ranges.cpp b/tests/std/tests/GH_000545_include_compare/test_ranges.cpp index fc4c9fd515..289277c640 100644 --- a/tests/std/tests/GH_000545_include_compare/test_ranges.cpp +++ b/tests/std/tests/GH_000545_include_compare/test_ranges.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include // TRANSITION, GH-395 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include @@ -10,6 +10,6 @@ static_assert(std::is_eq(std::partial_ordering::equivalent)); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 void test_ranges() {} diff --git a/tests/std/tests/GH_001411_core_headers/test.cpp b/tests/std/tests/GH_001411_core_headers/test.cpp index 1bf1d87f6c..0fe56769f9 100644 --- a/tests/std/tests/GH_001411_core_headers/test.cpp +++ b/tests/std/tests/GH_001411_core_headers/test.cpp @@ -19,9 +19,9 @@ #include #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include <__msvc_print.hpp> -#endif // ^^^ defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ _HAS_CXX20 ^^^ // <__msvc_bit_utils.hpp> is included by and // <__msvc_iter_core.hpp> is included by diff --git a/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp b/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp index 125a352d41..dcd167a365 100644 --- a/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp +++ b/tests/std/tests/GH_001596_adl_proof_algorithms/test.compile.pass.cpp @@ -49,7 +49,7 @@ struct holder { T t; }; -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template struct tagged_left_selector { template @@ -57,7 +57,7 @@ struct tagged_left_selector { return lhs; } }; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 struct incomplete; @@ -72,11 +72,11 @@ using validating_less = tagged_less>; using validating_compare_three_way = tagged_compare_three_way>; #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 using simple_left_selector = tagged_left_selector; using validating_left_selector = tagged_left_selector>; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 void test_algorithms() { int iarr[1]{}; @@ -182,10 +182,10 @@ void test_algorithms() { (void) std::lexicographical_compare(varr, varr, varr, varr); (void) std::lexicographical_compare(iarr, iarr, iarr, iarr, validating_less{}); -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 (void) std::lexicographical_compare_three_way(varr, varr, varr, varr); (void) std::lexicographical_compare_three_way(iarr, iarr, iarr, iarr, validating_compare_three_way{}); -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } #if _HAS_CXX17 @@ -274,7 +274,7 @@ void test_parallel_algorithms() { } #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 void test_ranges_non_projected_algorithms() { using namespace std::ranges; @@ -311,5 +311,5 @@ void test_ranges_non_projected_algorithms() { (void) fold_left_first_with_iter(iarr, iarr, validating_left_selector{}); (void) fold_left_first_with_iter(iarr, validating_left_selector{}); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _M_CEE diff --git a/tests/std/tests/GH_002769_handle_deque_block_pointers/test.cpp b/tests/std/tests/GH_002769_handle_deque_block_pointers/test.cpp index 34fde2bafc..1d71a44c9e 100644 --- a/tests/std/tests/GH_002769_handle_deque_block_pointers/test.cpp +++ b/tests/std/tests/GH_002769_handle_deque_block_pointers/test.cpp @@ -29,9 +29,9 @@ class counting_ptr { friend struct inconsistent_difference_allocator; public: -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 using iterator_category = random_access_iterator_tag; using value_type = T; using difference_type = Diff; diff --git a/tests/std/tests/GH_002989_nothrow_unwrappable/test.cpp b/tests/std/tests/GH_002989_nothrow_unwrappable/test.cpp index 00444b2923..f7f002e56f 100644 --- a/tests/std/tests/GH_002989_nothrow_unwrappable/test.cpp +++ b/tests/std/tests/GH_002989_nothrow_unwrappable/test.cpp @@ -49,7 +49,7 @@ void do_full_test() { do_single_test, CopyUnwrapNothrow>(); do_single_test, CopyUnwrapNothrow>(); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 using R = ranges::subrange; // TRANSITION, GH-2997 @@ -59,7 +59,7 @@ void do_full_test() { if constexpr (bidirectional_iterator) { do_single_test>, CopyUnwrapNothrow>(); } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } struct BidiIterUnwrapThrowing : vector::iterator { diff --git a/tests/std/tests/GH_004040_container_nonmember_functions/test.cpp b/tests/std/tests/GH_004040_container_nonmember_functions/test.cpp index 25c53023fa..1ec2c22408 100644 --- a/tests/std/tests/GH_004040_container_nonmember_functions/test.cpp +++ b/tests/std/tests/GH_004040_container_nonmember_functions/test.cpp @@ -286,9 +286,9 @@ CONSTEXPR20 bool test_array_comparison() { assert(!(A0{} > A0{})); assert(A0{} <= A0{}); assert(A0{} >= A0{}); -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 assert(A0{} <=> A0{} == strong_ordering::equal); -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using A1 = array; assert(A1{} == A1{}); @@ -297,9 +297,9 @@ CONSTEXPR20 bool test_array_comparison() { assert(!(A1{} > A1{})); assert(A1{} <= A1{}); assert(A1{} >= A1{}); -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 assert(A1{} <=> A1{} == strong_ordering::equal); -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 return true; } diff --git a/tests/std/tests/P0122R7_span/test.cpp b/tests/std/tests/P0122R7_span/test.cpp index 176df595bd..518a67b8f0 100644 --- a/tests/std/tests/P0122R7_span/test.cpp +++ b/tests/std/tests/P0122R7_span/test.cpp @@ -10,9 +10,9 @@ #include #include -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #include -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 using namespace std; @@ -74,10 +74,10 @@ static_assert(is_same_v::reverse_iterator, reverse_iterator::iterator>::pointer, const int*>); static_assert(is_same_v::reverse_iterator, reverse_iterator::iterator>>); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(ranges::enable_borrowed_range>); static_assert(ranges::enable_borrowed_range>); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 // N4901 [span.overview]/3 static_assert(is_trivially_copyable_v>); @@ -145,12 +145,12 @@ struct BasicRange { } }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace std::ranges { template inline constexpr bool enable_borrowed_range> = Borrowed; } -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 using ContiguousSizedRange = BasicRange; @@ -247,7 +247,7 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(is_nothrow_constructible_v, array::iterator, size_t>); // strengthened static_assert(!is_constructible_v, array::const_iterator, size_t>); static_assert(!is_constructible_v, array::iterator, size_t>); @@ -292,7 +292,7 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } { @@ -351,7 +351,7 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(is_nothrow_constructible_v, int*, const int*>); // strengthened static_assert(is_nothrow_constructible_v, int*, const int*>); // strengthened @@ -456,7 +456,7 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); static_assert(is_same_v>); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } { @@ -619,7 +619,7 @@ constexpr bool test() { FunctionTakingSpan(user_range); FunctionTakingSpan(as_const(user_range)); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(!is_constructible_v, ContiguousSizedRange>); static_assert(!is_constructible_v, ContiguousSizedRange>); static_assert(is_constructible_v, BorrowedContiguousSizedRange>); @@ -654,7 +654,7 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } { diff --git a/tests/std/tests/P0220R1_optional/test.cpp b/tests/std/tests/P0220R1_optional/test.cpp index 9d760fe8ed..459de3e062 100644 --- a/tests/std/tests/P0220R1_optional/test.cpp +++ b/tests/std/tests/P0220R1_optional/test.cpp @@ -136,7 +136,7 @@ int run_test() { #include #include -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 static_assert(!std::indirectly_readable >); static_assert(!std::indirectly_writable, int>); static_assert(!std::weakly_incrementable >); @@ -1064,7 +1064,7 @@ int run_test() { #include namespace or_else { -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 struct NonMovable { NonMovable() = default; NonMovable(NonMovable&&) = delete; @@ -1123,7 +1123,7 @@ int run_test() { int run_test() { return 0; } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#endif // _HAS_CXX23 } // namespace or_else // -- END: test/std/utilities/optional/optional.monadic/or_else.pass.cpp // -- BEGIN: test/std/utilities/optional/optional.monadic/transform.pass.cpp diff --git a/tests/std/tests/P0220R1_string_view/test.cpp b/tests/std/tests/P0220R1_string_view/test.cpp index bda8ed7943..f6db52ddb2 100644 --- a/tests/std/tests/P0220R1_string_view/test.cpp +++ b/tests/std/tests/P0220R1_string_view/test.cpp @@ -295,7 +295,7 @@ constexpr bool test_case_buffer_constructor() { } constexpr bool test_case_contiguous_constructor() { -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 const array expectedData{'n', 'o', ' ', 'n', 'u', 'l', 'l'}; // Also tests the corresponding deduction guide: same_as auto sv = basic_string_view(expectedData.begin(), expectedData.end()); @@ -307,13 +307,13 @@ constexpr bool test_case_contiguous_constructor() { assert(sv.at(1) == 'o'); assert(sv.front() == 'n'); assert(sv.back() == 'l'); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 return true; } constexpr bool test_case_range_constructor() { -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 const array expectedData{'n', 'o', ' ', 'n', 'u', 'l', 'l'}; // Also tests the corresponding deduction guide: same_as auto sv = basic_string_view(expectedData); @@ -343,7 +343,7 @@ constexpr bool test_case_range_constructor() { static_assert(is_constructible_v>); static_assert(is_constructible_v, string>); -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 return true; } diff --git a/tests/std/tests/P0355R7_calendars_and_time_zones_clocks/test.cpp b/tests/std/tests/P0355R7_calendars_and_time_zones_clocks/test.cpp index 9ed77e4bca..ea9dc08c50 100644 --- a/tests/std/tests/P0355R7_calendars_and_time_zones_clocks/test.cpp +++ b/tests/std/tests/P0355R7_calendars_and_time_zones_clocks/test.cpp @@ -154,7 +154,7 @@ constexpr bool test_leap_second() { static_assert(noexcept(equal >= leap)); static_assert(noexcept(leap >= equal)); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(is_eq(leap <=> equal)); static_assert(is_lt(leap <=> larger)); static_assert(is_gt(leap <=> smaller)); @@ -172,7 +172,7 @@ constexpr bool test_leap_second() { static_assert(is_lteq(leap <=> leap_second{equal, true, 0s})); static_assert(is_gteq(leap <=> leap_second{equal, true, 0s})); static_assert(noexcept(leap <=> leap_second{equal, true, 0s})); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 static_assert(noexcept(leap.date())); static_assert(noexcept(leap.value())); diff --git a/tests/std/tests/P0355R7_calendars_and_time_zones_time_zones/test.cpp b/tests/std/tests/P0355R7_calendars_and_time_zones_time_zones/test.cpp index a55118c262..77cdc85ecb 100644 --- a/tests/std/tests/P0355R7_calendars_and_time_zones_time_zones/test.cpp +++ b/tests/std/tests/P0355R7_calendars_and_time_zones_time_zones/test.cpp @@ -114,22 +114,22 @@ void timezone_names_test() { const time_zone tz3{_Secret_time_zone_construct_tag{}, "Later"}; assert(tz1 == tz2); assert(tz1 != tz3); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 assert(tz1 <=> tz2 == strong_ordering::equal); assert(tz1 <=> tz3 == strong_ordering::less); assert(tz3 <=> tz1 == strong_ordering::greater); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 const time_zone_link link1{_Secret_time_zone_link_construct_tag{}, "Earlier", "Target"}; const time_zone_link link2{_Secret_time_zone_link_construct_tag{}, "Earlier", "Is"}; const time_zone_link link3{_Secret_time_zone_link_construct_tag{}, "Later", "Ignored"}; assert(link1 == link2); assert(link1 != link3); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 assert(link1 <=> link2 == strong_ordering::equal); assert(link1 <=> link3 == strong_ordering::less); assert(link3 <=> link1 == strong_ordering::greater); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 try { // ensure locate_zone returns time_zone with given name diff --git a/tests/std/tests/P0401R6_allocate_at_least/test.cpp b/tests/std/tests/P0401R6_allocate_at_least/test.cpp index 12c1cd395c..e5715e421c 100644 --- a/tests/std/tests/P0401R6_allocate_at_least/test.cpp +++ b/tests/std/tests/P0401R6_allocate_at_least/test.cpp @@ -3,9 +3,9 @@ #include #include -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 #include -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 #include #include #include @@ -78,12 +78,12 @@ constexpr bool test() { { allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 same_as> auto result = al.allocate_at_least(5); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv auto result = al.allocate_at_least(5); static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ assert(result.ptr); assert(result.count >= 5); al.deallocate(result.ptr, 5); @@ -102,12 +102,12 @@ constexpr bool test() { { generous_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv auto result = allocator_traits::allocate_at_least(al, 4); static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ assert(result.ptr); assert(result.count == 16); al.deallocate(result.ptr, result.count); @@ -116,12 +116,12 @@ constexpr bool test() { { strict_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv auto result = allocator_traits::allocate_at_least(al, 4); static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ assert(result.ptr); assert(result.count == 4); al.deallocate(result.ptr, result.count); @@ -130,13 +130,13 @@ constexpr bool test() { { small_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv auto result = allocator_traits::allocate_at_least(al, 4); static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ assert(result.ptr); assert(result.count == 4); al.deallocate(result.ptr, result.count); @@ -145,13 +145,13 @@ constexpr bool test() { { huge_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +#if _HAS_CXX20 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv auto result = allocator_traits::allocate_at_least(al, 4); static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ assert(result.ptr); assert(result.count == 4); al.deallocate(result.ptr, result.count); diff --git a/tests/std/tests/P0433R2_deduction_guides/test.cpp b/tests/std/tests/P0433R2_deduction_guides/test.cpp index e943019850..0a7725ed5d 100644 --- a/tests/std/tests/P0433R2_deduction_guides/test.cpp +++ b/tests/std/tests/P0433R2_deduction_guides/test.cpp @@ -501,13 +501,13 @@ void test_basic_string() { static_assert(is_same_v, MyAlloc>>); static_assert(is_same_v, MyAlloc>>); -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 basic_string str19(from_range, first); basic_string str20(from_range, first, myal); static_assert(is_same_v); static_assert(is_same_v, MyAlloc>>); -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 } void test_basic_string_view() { @@ -567,13 +567,13 @@ void test_sequence_container() { static_assert(is_same_v>>); static_assert(is_same_v>>); -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 Sequence c8(from_range, first); Sequence c9(from_range, first, myal); static_assert(is_same_v>); static_assert(is_same_v>>); -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 } void test_vector_bool() { @@ -598,13 +598,13 @@ void test_vector_bool() { static_assert(is_same_v>>); static_assert(is_same_v>>); -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 vector vb8(from_range, first); vector vb9(from_range, first, myal); static_assert(is_same_v>); static_assert(is_same_v>>); -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 } template