From 0c47a7cfc92775a5fe0a81bc397f254e9691764c Mon Sep 17 00:00:00 2001 From: "S. B. Tam" Date: Tue, 6 Feb 2024 17:05:52 +0800 Subject: [PATCH] Enable `__cpp_lib_concepts` for EDG, part 3 (#4298) Co-authored-by: Stephan T. Lavavej --- stl/inc/__msvc_chrono.hpp | 8 +- stl/inc/__msvc_formatter.hpp | 4 +- stl/inc/__msvc_int128.hpp | 12 +- stl/inc/__msvc_iter_core.hpp | 6 +- stl/inc/__msvc_print.hpp | 4 +- stl/inc/algorithm | 230 ++++++------ stl/inc/array | 26 +- stl/inc/chrono | 39 +- stl/inc/compare | 7 - stl/inc/concepts | 8 +- stl/inc/coroutine | 4 - stl/inc/deque | 38 +- stl/inc/expected | 6 +- stl/inc/filesystem | 12 +- stl/inc/format | 6 +- stl/inc/forward_list | 38 +- stl/inc/functional | 194 +--------- stl/inc/iterator | 56 +-- stl/inc/list | 42 ++- stl/inc/map | 54 ++- stl/inc/mdspan | 6 +- stl/inc/memory | 62 ++-- stl/inc/numbers | 43 --- stl/inc/numeric | 4 +- stl/inc/optional | 34 +- stl/inc/queue | 34 +- stl/inc/regex | 8 +- stl/inc/set | 52 ++- stl/inc/span | 146 +------- stl/inc/spanstream | 6 - stl/inc/stack | 18 +- stl/inc/stacktrace | 17 +- stl/inc/system_error | 38 +- stl/inc/thread | 8 +- stl/inc/tuple | 66 ++-- stl/inc/type_traits | 4 +- stl/inc/unordered_map | 16 +- stl/inc/unordered_set | 16 +- stl/inc/utility | 27 +- stl/inc/variant | 4 +- stl/inc/vector | 90 ++--- stl/inc/xhash | 4 +- stl/inc/xmemory | 43 +-- stl/inc/xstring | 48 +-- stl/inc/xtree | 4 +- stl/inc/xutility | 245 +++++++------ .../include/test_min_max_element_support.hpp | 6 +- .../test.cpp | 8 +- .../test.cpp | 4 +- .../test.cpp | 20 +- .../test.compile.pass.cpp | 20 +- .../tests/GH_000431_copy_move_family/test.cpp | 4 +- .../std/tests/GH_000431_equal_family/test.cpp | 8 +- .../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 | 5 - .../std/tests/GH_001411_core_headers/test.cpp | 4 +- .../test.compile.pass.cpp | 8 +- .../GH_002030_asan_annotate_string/test.cpp | 2 - .../test.cpp | 4 +- .../GH_002989_nothrow_unwrappable/test.cpp | 4 +- .../test.cpp | 8 +- .../test.compile.pass.cpp | 16 +- tests/std/tests/P0122R7_span/test.cpp | 15 +- tests/std/tests/P0220R1_optional/test.cpp | 8 +- tests/std/tests/P0220R1_string_view/test.cpp | 8 +- .../test.cpp | 2 - .../test.cpp | 4 - .../tests/P0401R6_allocate_at_least/test.cpp | 27 -- .../tests/P0433R2_deduction_guides/test.cpp | 36 +- tests/std/tests/P0448R4_spanstream/test.cpp | 4 - .../test.cpp | 4 +- .../tests/P0768R1_spaceship_operator/test.cpp | 4 - .../tests/P0784R7_library_machinery/test.cpp | 2 - .../test.cpp | 44 --- .../test.cpp | 2 - tests/std/tests/P0881R7_stacktrace/test.cpp | 2 - .../tests/P0896R4_stream_iterators/test.cpp | 32 +- .../tests/P0980R1_constexpr_strings/test.cpp | 332 +++++++++--------- .../tests/P1522R1_difference_type/test.cpp | 47 ++- .../tests/P2321R2_proxy_reference/test.cpp | 4 - .../tests/VSO_0000000_type_traits/test.cpp | 4 - .../VSO_0000000_vector_algorithms/test.cpp | 26 +- .../test.compile.pass.cpp | 74 ++-- 86 files changed, 1029 insertions(+), 1674 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..6934fe27f9 100644 --- a/stl/inc/__msvc_int128.hpp +++ b/stl/inc/__msvc_int128.hpp @@ -17,19 +17,15 @@ #if _HAS_CXX20 #include +#include +#define _TEMPLATE_CLASS_INTEGRAL(type) template #define _ZERO_OR_NO_INIT #else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv +#define _TEMPLATE_CLASS_INTEGRAL(type) template , int> = 0> #define _ZERO_OR_NO_INIT \ {} // Trivial default initialization is not allowed in constexpr functions before C++20. #endif // ^^^ !_HAS_CXX20 ^^^ -#ifdef __cpp_lib_concepts -#include -#define _TEMPLATE_CLASS_INTEGRAL(type) template -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv -#define _TEMPLATE_CLASS_INTEGRAL(type) template , int> = 0> -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ - #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) @@ -308,7 +304,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..edaedc8f3d 100644 --- a/stl/inc/__msvc_print.hpp +++ b/stl/inc/__msvc_print.hpp @@ -8,9 +8,9 @@ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_concepts // note: includes this header in C++20 mode +#if !_HAS_CXX20 // 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 47f957d9ed..19d78ba353 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>; @@ -1600,7 +1600,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( @@ -1639,7 +1639,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>; @@ -1703,7 +1703,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 @@ -1737,7 +1737,7 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt partition_point(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { @@ -1811,7 +1811,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: @@ -1905,7 +1905,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) { @@ -2095,7 +2095,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: @@ -2951,7 +2951,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( @@ -3053,7 +3053,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: @@ -3213,7 +3213,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( @@ -3256,7 +3256,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: @@ -3416,7 +3416,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) { @@ -3491,7 +3491,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>; @@ -3597,7 +3597,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) { @@ -3618,7 +3618,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: @@ -3670,7 +3670,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) { @@ -3690,7 +3690,7 @@ _EXPORT_STD template _CONSTEXPR20 _OutIt replace_copy(_InIt _First, _InIt _Last, _OutIt _Dest, const _Ty& _Oldval, const _Ty& _Newval) { @@ -3774,7 +3774,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>; @@ -3834,7 +3834,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) { @@ -3868,7 +3868,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>; @@ -4031,7 +4031,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() @@ -4145,7 +4145,7 @@ _EXPORT_STD template _NODISCARD_UNIQUE_ALG _CONSTEXPR20 _FwdIt unique(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { @@ -4417,7 +4417,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: @@ -4481,10 +4481,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 @@ -4572,7 +4572,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>; @@ -4735,7 +4735,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) { @@ -4797,7 +4797,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>; @@ -4875,10 +4875,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) { @@ -4983,7 +4983,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) { @@ -5009,7 +5009,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>; @@ -5059,7 +5059,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 @@ -5208,7 +5208,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>; @@ -5315,7 +5315,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Sample_fn sample; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -5347,7 +5347,7 @@ void shuffle(_RanIt _First, _RanIt _Last, _Urng&& _Func) { // shuffle [_First, _ _STD _Random_shuffle1(_First, _Last, _RngFunc); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Shuffle_fn { public: @@ -5401,7 +5401,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 @@ -5563,7 +5563,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: @@ -5786,7 +5786,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) { @@ -5850,7 +5850,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: @@ -5928,7 +5928,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partition_fn partition; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -6101,7 +6101,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, @@ -6296,7 +6296,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( @@ -6333,7 +6333,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> @@ -6401,7 +6401,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( @@ -6467,7 +6467,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> @@ -6562,7 +6562,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) { @@ -6588,7 +6588,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> @@ -6635,7 +6635,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) { @@ -6702,7 +6702,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( @@ -6780,7 +6780,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 @@ -6810,7 +6810,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> @@ -6953,7 +6953,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) { @@ -6998,7 +6998,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: @@ -7057,7 +7057,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) { @@ -7075,7 +7075,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: @@ -7104,7 +7104,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 {}; @@ -7197,7 +7197,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>; @@ -7272,7 +7272,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: @@ -7541,7 +7541,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>> @@ -7859,7 +7859,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) { @@ -8043,7 +8043,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> @@ -8255,7 +8255,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) { @@ -8450,7 +8450,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: @@ -8699,7 +8699,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) { @@ -8748,7 +8748,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: @@ -8818,7 +8818,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 @@ -8880,7 +8880,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>; @@ -8964,7 +8964,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 @@ -9016,7 +9016,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: @@ -9086,7 +9086,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 @@ -9140,7 +9140,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: @@ -9209,7 +9209,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 @@ -9274,7 +9274,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>; @@ -9347,7 +9347,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 @@ -9400,7 +9400,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>; @@ -9479,7 +9479,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 @@ -9533,7 +9533,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>; @@ -9607,7 +9607,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 @@ -9675,7 +9675,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>; @@ -9758,7 +9758,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 @@ -9850,7 +9850,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>; @@ -9949,7 +9949,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 @@ -9990,7 +9990,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>; @@ -10150,7 +10150,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) { @@ -10189,7 +10189,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>; @@ -10253,7 +10253,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) { @@ -10292,7 +10292,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>; @@ -10356,7 +10356,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) { @@ -10419,7 +10419,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: @@ -10468,7 +10468,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) { @@ -10503,7 +10503,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: @@ -10608,7 +10608,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..6c9ee17926 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; @@ -778,21 +778,19 @@ _NODISCARD _CONSTEXPR20 bool operator==(const array<_Ty, _Size>& _Left, const ar return _STD equal(_Left.data(), _Left.data() + _Size, _Right.data()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { - return !(_Left == _Right); -} -#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 bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { + return !(_Left == _Right); +} + 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 +810,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 982be0a92d..0dc7548bcb 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -20,8 +20,11 @@ #include #include #include +#include #include +#include #include +#include #include #include #include @@ -30,12 +33,6 @@ #include #include #include - -#ifdef __cpp_lib_concepts -#include -#include -#include -#endif // defined(__cpp_lib_concepts) #endif // _HAS_CXX20 #pragma pack(push, _CRT_PACKING) @@ -1699,15 +1696,8 @@ namespace chrono { : runtime_error(_Make_string(_Tp, _Info)) {} private: -#ifdef __cpp_lib_concepts template _NODISCARD static string _Make_string(const local_time<_Duration>& _Tp, const local_info& _Info); -#else // ^^^ no workaround / workaround vvv - template - _NODISCARD static string _Make_string(const local_time<_Duration>&, const local_info&) { - return "nonexistent_local_time"; - } -#endif // ^^^ workaround ^^^ }; template @@ -1722,15 +1712,8 @@ namespace chrono { : runtime_error(_Make_string(_Tp, _Info)) {} private: -#ifdef __cpp_lib_concepts template _NODISCARD static string _Make_string(const local_time<_Duration>& _Tp, const local_info& _Info); -#else // ^^^ no workaround / workaround vvv - template - _NODISCARD static string _Make_string(const local_time<_Duration>&, const local_info&) { - return "ambiguous_local_time"; - } -#endif // ^^^ workaround ^^^ }; template @@ -1927,12 +1910,10 @@ namespace chrono { return _Left.name() == _Right.name(); } -#ifdef __cpp_lib_concepts _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) // [time.zone.leap] @@ -2013,7 +1994,6 @@ namespace chrono { return !(_Left < _Right.date()); } -#ifdef __cpp_lib_concepts _EXPORT_STD template requires three_way_comparable_with> _NODISCARD constexpr auto operator<=>(const leap_second& _Left, const sys_time<_Duration>& _Right) noexcept { @@ -2023,7 +2003,6 @@ namespace chrono { const leap_second& _Left, const leap_second& _Right) noexcept { return _Left.date() <=> _Right.date(); } -#endif // defined(__cpp_lib_concepts) // [time.zone.link] @@ -2056,12 +2035,10 @@ namespace chrono { return _Left.name() == _Right.name(); } -#ifdef __cpp_lib_concepts _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) // [time.zone.db] @@ -2648,13 +2625,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 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 - : _Utc_leap_second == _Time_floor ? strong_ordering::equal - : strong_ordering::less; -#endif // ^^^ workaround if (_Tzdb._All_ls_positive && _STD is_gt(_Leap_cmp)) { // Case (1) --_It; } @@ -4693,8 +4664,7 @@ namespace chrono { } } // namespace chrono -#ifdef __cpp_lib_concepts - // [time.format] +// [time.format] // clang-format off template @@ -6013,7 +5983,6 @@ namespace chrono { return _STD move(_Os).str(); } } // namespace chrono -#endif // defined(__cpp_lib_concepts) inline namespace literals { inline namespace chrono_literals { diff --git a/stl/inc/compare b/stl/inc/compare index e35d1a3a4d..d5741f1961 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -11,11 +11,7 @@ #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 #include -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv -#include -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -295,7 +291,6 @@ struct common_comparison_category { using type = common_comparison_category_t<_Types...>; }; -#ifdef __cpp_lib_concepts template concept _Compares_as = same_as, _Cat>; @@ -842,8 +837,6 @@ namespace _Compare_partial_order_fallback { inline namespace _Cpos { _EXPORT_STD inline constexpr _Compare_partial_order_fallback::_Cpo compare_partial_order_fallback; } - -#endif // defined(__cpp_lib_concepts) _STD_END #pragma pop_macro("new") diff --git a/stl/inc/concepts b/stl/inc/concepts index c377e117b1..ce4f05172a 100644 --- a/stl/inc/concepts +++ b/stl/inc/concepts @@ -8,9 +8,9 @@ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_concepts -_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 +#if !_HAS_CXX20 +_EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); +#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..aef71fc05c 100644 --- a/stl/inc/coroutine +++ b/stl/inc/coroutine @@ -160,11 +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 return compare_three_way{}(_Left.address(), _Right.address()); -#else // ^^^ no workaround / workaround vvv - return _Left.address() <=> _Right.address(); -#endif // ^^^ workaround ^^^ } #else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD constexpr bool operator!=(const coroutine_handle<> _Left, const coroutine_handle<> _Right) noexcept { diff --git a/stl/inc/deque b/stl/inc/deque index ba0794eb24..766f4a0ad0 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(_STD _Get_unwrapped(_First), _STD _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(); @@ -1239,7 +1239,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(); @@ -1279,7 +1279,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); @@ -1305,7 +1305,7 @@ public: _Off, _STD _Get_unwrapped(_First), _STD _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()); @@ -1317,7 +1317,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()); @@ -1777,11 +1777,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 */ { @@ -1794,20 +1794,18 @@ _NODISCARD bool operator==(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Al && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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 !(_Left == _Right); +} + template _NODISCARD bool operator<(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -1828,7 +1826,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 8a17025e66..2d29ec7139 100644 --- a/stl/inc/expected +++ b/stl/inc/expected @@ -7,9 +7,9 @@ #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 +#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv #include #include #include @@ -1900,6 +1900,6 @@ _STD_END _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ supported language mode ^^^ +#endif // ^^^ _HAS_CXX23 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _EXPECTED_ diff --git a/stl/inc/filesystem b/stl/inc/filesystem index a08e435d4c..f41896c8e2 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -2735,11 +2735,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); @@ -2991,11 +2991,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); @@ -4450,7 +4450,7 @@ struct hash { } }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template <> inline constexpr bool enable_borrowed_range = true; @@ -4461,7 +4461,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 d5e6de99b8..cd8a0747bf 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> @@ -4111,6 +4111,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 141d8f1d2a..6d6df03115 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(_STD _Get_unwrapped(_First), _STD _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, _STD _Get_unwrapped(_First), _STD _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 */ { @@ -1577,21 +1577,19 @@ _NODISCARD bool operator==(const forward_list<_Ty, _Alloc>& _Left, const forward _Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin(), _Right._Unchecked_end_iter()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const forward_list<_Ty, _Alloc>& _Left, const forward_list<_Ty, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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 !(_Left == _Right); +} + template _NODISCARD bool operator<(const forward_list<_Ty, _Alloc>& _Left, const forward_list<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -1612,7 +1610,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..3fe6623df3 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,20 +586,9 @@ _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 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 -template -inline constexpr bool _Can_invoke_then_negate_impl = false; -template -inline constexpr bool _Can_invoke_then_negate_impl< - void_t(), _STD declval<_Types>()...))>, _Callable, _Types...> = true; - -template -inline constexpr bool _Can_invoke_then_negate = _Can_invoke_then_negate_impl; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ #endif // _HAS_CXX20 struct _Not_fn_tag { @@ -620,7 +609,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( @@ -660,43 +649,7 @@ public: template void operator()(_Types&&...) const&& = delete; -#elif _HAS_CXX20 // ^^^ _HAS_CXX20 && defined(__cpp_lib_concepts) / _HAS_CXX20 && !defined(__cpp_lib_concepts) vvv - template , int> = 0> - constexpr decltype(auto) operator()(_Types&&... _Args) & noexcept( - noexcept(!_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...))) { - return !_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...); - } - - template , int> = 0> - constexpr decltype(auto) operator()(_Types&&... _Args) const& noexcept( - noexcept(!_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...))) { - return !_STD invoke(this->_Get_val(), _STD forward<_Types>(_Args)...); - } - - template , int> = 0> - constexpr decltype(auto) operator()(_Types&&... _Args) && noexcept( - noexcept(!_STD invoke(_STD move(this->_Get_val()), _STD forward<_Types>(_Args)...))) { - return !_STD invoke(_STD move(this->_Get_val()), _STD forward<_Types>(_Args)...); - } - - template , int> = 0> - constexpr decltype(auto) operator()(_Types&&... _Args) const&& noexcept( - noexcept(!_STD invoke(_STD move(this->_Get_val()), _STD forward<_Types>(_Args)...))) { - return !_STD invoke(_STD move(this->_Get_val()), _STD forward<_Types>(_Args)...); - } - - template , int> = 0> - void operator()(_Types&&...) & = delete; - - template , int> = 0> - void operator()(_Types&&...) const& = delete; - - template , int> = 0> - void operator()(_Types&&...) && = delete; - - 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 +2079,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 +2126,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)) { @@ -2191,7 +2144,7 @@ public: template void operator()(_Unbound&&...) const = delete; -#else // ^^^ requires available / requires unavailable vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template >, int> = 0> _CONSTEXPR20 decltype(auto) operator()(_Unbound&&... _Unbargs) noexcept(noexcept(_CALL_BINDER)) { @@ -2211,7 +2164,7 @@ public: template >, int> = 0> void operator()(_Unbound&&...) const = delete; -#endif // ^^^ requires unavailable ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ #undef _CALL_BINDER }; @@ -2259,26 +2212,11 @@ constexpr auto _Call_front_binder(index_sequence<_Ix...>, _Cv_FD&& _Obj, _Cv_tup _STD forward<_Unbound>(_Unbargs)...); } -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 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), _STD forward<_Unbound>(_Unbound_args)...); }; -#else // ^^^ concept available / concept unavailable vvv -template -inline constexpr bool _Can_call_front_binder_impl = false; - -template -inline constexpr bool - _Can_call_front_binder_impl(), - _STD declval<_CvBoundTuple>(), _STD declval<_Unbound>()...))>, - _IntSeq, _CvFD, _CvBoundTuple, _Unbound...> = true; - -template -inline constexpr bool _Can_call_front_binder = - _Can_call_front_binder_impl; -#endif // ^^^ concept unavailable ^^^ template class _Front_binder { // wrap bound callable object and arguments @@ -2296,7 +2234,6 @@ 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 template requires _Can_call_front_binder<_Seq, _Fx&, tuple<_Types...>&, _Unbound...> constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( @@ -2340,54 +2277,6 @@ public: template void operator()(_Unbound&&...) const&& = delete; -#else // ^^^ requires available / requires unavailable vvv - template &, _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( - _STD _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_front_binder( - _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...); - } - - template &, _Unbound...>, int> = 0> - void operator()(_Unbound&&...) & = delete; - - template &, _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) const& noexcept(noexcept( - _STD _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_front_binder( - _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...); - } - - template &, _Unbound...>, int> = 0> - void operator()(_Unbound&&...) const& = delete; - - template , _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) && noexcept(noexcept(_STD _Call_front_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_front_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...); - } - - template , _Unbound...>, int> = 0> - void operator()(_Unbound&&...) && = delete; - - template , _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) const&& noexcept(noexcept(_STD _Call_front_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_front_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...); - } - - template , _Unbound...>, int> = 0> - void operator()(_Unbound&&...) const&& = delete; -#endif // ^^^ requires unavailable ^^^ }; _EXPORT_STD template @@ -2416,26 +2305,11 @@ 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 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), _STD forward<_Unbound>(_Unbound_args)...); }; -#else // ^^^ concept available / concept unavailable vvv -template -inline constexpr bool _Can_call_back_binder_impl = false; - -template -inline constexpr bool - _Can_call_back_binder_impl(), - _STD declval<_CvBoundTuple>(), _STD declval<_Unbound>()...))>, - _IntSeq, _CvFD, _CvBoundTuple, _Unbound...> = true; - -template -inline constexpr bool _Can_call_back_binder = - _Can_call_back_binder_impl; -#endif // ^^^ concept unavailable ^^^ template class _Back_binder { // wrap bound callable object and arguments @@ -2453,7 +2327,6 @@ 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 template requires _Can_call_back_binder<_Seq, _Fx&, tuple<_Types...>&, _Unbound...> constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( @@ -2497,53 +2370,6 @@ public: template void operator()(_Unbound&&...) const&& = delete; -#else // ^^^ requires available / requires unavailable vvv - template &, _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( - _STD _Call_back_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_back_binder( - _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...); - } - - template &, _Unbound...>, int> = 0> - void operator()(_Unbound&&...) & = delete; - - template &, _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) const& noexcept(noexcept( - _STD _Call_back_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_back_binder( - _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, _STD forward<_Unbound>(_Unbargs)...); - } - - template &, _Unbound...>, int> = 0> - void operator()(_Unbound&&...) const& = delete; - - template , _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) && noexcept(noexcept(_STD _Call_back_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_back_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...); - } - - template , _Unbound...>, int> = 0> - void operator()(_Unbound&&...) && = delete; - - template , _Unbound...>, int> = 0> - constexpr decltype(auto) operator()(_Unbound&&... _Unbargs) const&& noexcept(noexcept(_STD _Call_back_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...))) { - return _STD _Call_back_binder( - _Seq{}, _STD move(_Mypair._Get_first()), _STD move(_Mypair._Myval2), _STD forward<_Unbound>(_Unbargs)...); - } - - template , _Unbound...>, int> = 0> - void operator()(_Unbound&&...) const&& = delete; -#endif // ^^^ requires unavailable ^^^ }; _EXPORT_STD template @@ -3206,7 +3032,7 @@ private: }; #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { _EXPORT_STD struct not_equal_to { template @@ -3241,7 +3067,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 01d6a22c2d..fcf0fa923c 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,13 +128,13 @@ 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 +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv using difference_type = void; using _Wrapped_iter = typename _Container::iterator; -#endif // ^^^ no Ranges ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _CONSTEXPR20 insert_iterator(_Container& _Cont, _Wrapped_iter _Where) : container(_STD addressof(_Cont)), iter(_STD move(_Where)) {} @@ -169,12 +169,12 @@ 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); } -#else // ^^^ No Ranges / Ranges vvv +#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv _EXPORT_STD template _NODISCARD constexpr insert_iterator<_Container> inserter(_Container& _Cont, _RANGES iterator_t<_Container> _Where) { return insert_iterator<_Container>(_Cont, _Where); @@ -230,7 +230,7 @@ public: private: _Se _Last{}; }; -#endif // ^^^ Ranges ^^^ +#endif // ^^^ _HAS_CXX20 ^^^ _EXPORT_STD template , class _Diff = ptrdiff_t> class istream_iterator { @@ -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 @@ -1492,9 +1492,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; @@ -1706,9 +1706,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 74c0902b05..69f22627c2 100644 --- a/stl/inc/list +++ b/stl/inc/list @@ -886,7 +886,7 @@ public: _Construct_range_unchecked(_STD _Get_unwrapped(_First), _STD _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(_STD _Get_unwrapped(_First), _STD _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 */ { @@ -1880,20 +1880,18 @@ _NODISCARD bool operator==(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Allo && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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 !(_Left == _Right); +} + template _NODISCARD bool operator<(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -1914,7 +1912,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..a8b764723f 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 @@ -402,21 +402,19 @@ _NODISCARD bool operator==(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_ && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_Kty, _Ty, _Pr, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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 !(_Left == _Right); +} + template _NODISCARD bool operator<(const map<_Kty, _Ty, _Pr, _Alloc>& _Left, const map<_Kty, _Ty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -437,7 +435,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 +513,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 +533,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 +614,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 +624,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 @@ -636,22 +634,20 @@ _NODISCARD bool operator==( && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=( - const multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, const multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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) { + return !(_Left == _Right); +} + template _NODISCARD bool operator<( const multimap<_Kty, _Ty, _Pr, _Alloc>& _Left, const multimap<_Kty, _Ty, _Pr, _Alloc>& _Right) { @@ -676,7 +672,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..601c0b3874 100644 --- a/stl/inc/mdspan +++ b/stl/inc/mdspan @@ -7,9 +7,9 @@ #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 +#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv #include #include #include @@ -1479,6 +1479,6 @@ _STD_END _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ supported language mode ^^^ +#endif // ^^^ _HAS_CXX23 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _MDSPAN_ diff --git a/stl/inc/memory b/stl/inc/memory index 842186a362..e199410fd0 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: @@ -554,7 +554,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 @@ -567,7 +567,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> @@ -606,7 +606,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) { @@ -632,7 +632,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: @@ -662,7 +662,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) { @@ -683,7 +683,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: @@ -731,7 +731,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) { @@ -760,7 +760,7 @@ _EXPORT_STD template void uninitialized_value_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { @@ -813,7 +813,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: @@ -859,7 +859,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) { @@ -877,7 +877,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, @@ -3675,7 +3675,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 { @@ -3741,14 +3741,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 {}; @@ -4259,7 +4259,7 @@ public: }; #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template struct _Pointer_of_helper {}; @@ -4461,7 +4461,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..db2ec33f79 100644 --- a/stl/inc/numbers +++ b/stl/inc/numbers @@ -10,11 +10,7 @@ #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 #include -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv -#include -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -25,7 +21,6 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN namespace numbers { -#ifdef __cpp_lib_concepts template struct _Invalid { static_assert(_Always_false<_Ty>, "A program that instantiates a primary template of a mathematical constant " @@ -85,44 +80,6 @@ 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 - template - struct _Reject_invalid { - static_assert(is_floating_point_v<_Ty>, "A program that instantiates a primary template of a mathematical " - "constant variable template is ill-formed. (N4950 [math.constants]/3)"); - using type = _Ty; - }; - - template - using _Reject_invalid_t = _Reject_invalid<_Ty>::type; - - _EXPORT_STD template - inline constexpr _Ty e_v = static_cast<_Reject_invalid_t<_Ty>>(2.718281828459045); - _EXPORT_STD template - inline constexpr _Ty log2e_v = static_cast<_Reject_invalid_t<_Ty>>(1.4426950408889634); - _EXPORT_STD template - inline constexpr _Ty log10e_v = static_cast<_Reject_invalid_t<_Ty>>(0.4342944819032518); - _EXPORT_STD template - inline constexpr _Ty pi_v = static_cast<_Reject_invalid_t<_Ty>>(3.141592653589793); - _EXPORT_STD template - inline constexpr _Ty inv_pi_v = static_cast<_Reject_invalid_t<_Ty>>(0.3183098861837907); - _EXPORT_STD template - inline constexpr _Ty inv_sqrtpi_v = static_cast<_Reject_invalid_t<_Ty>>(0.5641895835477563); - _EXPORT_STD template - inline constexpr _Ty ln2_v = static_cast<_Reject_invalid_t<_Ty>>(0.6931471805599453); - _EXPORT_STD template - inline constexpr _Ty ln10_v = static_cast<_Reject_invalid_t<_Ty>>(2.302585092994046); - _EXPORT_STD template - inline constexpr _Ty sqrt2_v = static_cast<_Reject_invalid_t<_Ty>>(1.4142135623730951); - _EXPORT_STD template - inline constexpr _Ty sqrt3_v = static_cast<_Reject_invalid_t<_Ty>>(1.7320508075688772); - _EXPORT_STD template - inline constexpr _Ty inv_sqrt3_v = static_cast<_Reject_invalid_t<_Ty>>(0.5773502691896257); - _EXPORT_STD template - 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) ^^^ _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 c9ffb26b59..0018cd4961 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 47fe2d9836..9cbc960b2d 100644 --- a/stl/inc/optional +++ b/stl/inc/optional @@ -586,7 +586,6 @@ public: } } -#ifdef __cpp_lib_concepts template _Fn> requires copy_constructible<_Ty> constexpr optional or_else(_Fn&& _Func) const& { @@ -612,7 +611,6 @@ public: return _STD forward<_Fn>(_Func)(); } } -#endif // defined(__cpp_lib_concepts) #endif // _HAS_CXX23 using _Mybase::reset; @@ -624,11 +622,11 @@ optional(_Ty) -> optional<_Ty>; _EXPORT_STD template _NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) noexcept( noexcept(_STD _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 +639,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(_STD _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 +656,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(_STD _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 +673,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(_STD _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 +690,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(_STD _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 +707,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(_STD _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 +721,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 +733,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 +927,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 +938,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..461f705433 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,8 @@ 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 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_CXX23 template , int> = 0> @@ -81,11 +79,9 @@ public: is_nothrow_constructible_v<_Container, _InIt, _InIt, const _Alloc&>) // strengthened : c(_STD move(_First), _STD move(_Last), _Al) {} -#ifdef __cpp_lib_concepts 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_CXX23 _NODISCARD_EMPTY_ADAPTOR_MEMBER bool empty() const noexcept(noexcept(c.empty())) /* strengthened */ { @@ -120,7 +116,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 +125,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 +167,10 @@ 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 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_CXX23 _EXPORT_STD template @@ -209,13 +203,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 +270,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 +338,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 +352,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 +376,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 +399,7 @@ public: } } } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template void emplace(_Valty&&... _Val) { @@ -465,7 +459,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 +473,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 @@ -211,21 +211,19 @@ _NODISCARD bool operator==(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, _Pr, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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 !(_Left == _Right); +} + template _NODISCARD bool operator<(const set<_Kty, _Pr, _Alloc>& _Left, const set<_Kty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -246,7 +244,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 +320,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 +340,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 +408,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 +417,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 @@ -428,21 +426,19 @@ _NODISCARD bool operator==(const multiset<_Kty, _Pr, _Alloc>& _Left, const multi && _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end_iter(), _Right._Unchecked_begin()); } -#if !_HAS_CXX20 -template -_NODISCARD bool operator!=(const multiset<_Kty, _Pr, _Alloc>& _Left, const multiset<_Kty, _Pr, _Alloc>& _Right) { - return !(_Left == _Right); -} -#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 !(_Left == _Right); +} + template _NODISCARD bool operator<(const multiset<_Kty, _Pr, _Alloc>& _Left, const multiset<_Kty, _Pr, _Alloc>& _Right) { return _STD lexicographical_compare( @@ -463,7 +459,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..330f4d3887 100644 --- a/stl/inc/span +++ b/stl/inc/span @@ -29,9 +29,7 @@ _EXPORT_STD inline constexpr size_t dynamic_extent = static_cast(-1); template struct _Span_iterator { -#ifdef __cpp_lib_concepts - using iterator_concept = contiguous_iterator_tag; -#endif // defined(__cpp_lib_concepts) + using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = remove_cv_t<_Ty>; using difference_type = ptrdiff_t; @@ -224,7 +222,6 @@ struct _Span_extent_type<_Ty, dynamic_extent> { _EXPORT_STD template class span; -#ifdef __cpp_lib_concepts namespace ranges { template inline constexpr bool enable_view> = true; @@ -257,40 +254,6 @@ 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 - -template -struct _Is_span : false_type {}; - -template -struct _Is_span> : true_type {}; - -template -struct _Is_std_array : false_type {}; - -template -struct _Is_std_array> : true_type {}; - -template -struct _Is_span_convertible_range - : bool_constant()))> (*)[], _Ty (*)[]>> {}; - -template -struct _Has_container_interface : false_type {}; - -template -struct _Has_container_interface<_Rng, - void_t())), decltype(_STD size(_STD declval<_Rng&>()))>> : true_type {}; - -template -inline constexpr bool _Is_span_compatible_range = conjunction_v< // - negation>, // - negation<_Is_span>>, // - negation<_Is_std_array>>, // - _Has_container_interface<_Rng>, // - _Is_span_convertible_range<_Rng, _Ty>>; - -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ // [views.span] _EXPORT_STD template @@ -311,16 +274,14 @@ 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 - // clang-format off constexpr span() noexcept requires (_Extent == 0 || _Extent == dynamic_extent) = default; // clang-format on @@ -387,87 +348,6 @@ public: #endif // _CONTAINER_DEBUG_LEVEL > 0 } -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - - template = 0> - constexpr span() noexcept {} - - constexpr explicit(_Extent != dynamic_extent) span(pointer _Ptr, size_type _Count) noexcept // strengthened - : _Mybase(_Ptr, _Count) { -#if _CONTAINER_DEBUG_LEVEL > 0 - if constexpr (_Extent != dynamic_extent) { - _STL_VERIFY(_Count == _Extent, - "Cannot construct span with static extent from range [ptr, ptr + count) as count != extent"); - } -#endif // _CONTAINER_DEBUG_LEVEL > 0 - } - - constexpr explicit(_Extent != dynamic_extent) span(pointer _First, pointer _Last) noexcept // strengthened - : _Mybase(_First, static_cast(_Last - _First)) { - _Adl_verify_range(_First, _Last); -#if _CONTAINER_DEBUG_LEVEL > 0 - if constexpr (_Extent != dynamic_extent) { - _STL_VERIFY(_Last - _First == _Extent, - "Cannot construct span with static extent from range [first, last) as last - first != extent"); - } -#endif // _CONTAINER_DEBUG_LEVEL > 0 - } - - template = 0> - constexpr span(element_type (&_Arr)[_Size]) noexcept : _Mybase(_Arr, _Size) {} - - template , - is_convertible<_OtherTy (*)[], element_type (*)[]>>, - int> = 0> - constexpr span(array<_OtherTy, _Size>& _Arr) noexcept : _Mybase(_Arr.data(), _Size) {} - - template , - is_convertible>, - int> = 0> - constexpr span(const array<_OtherTy, _Size>& _Arr) noexcept : _Mybase(_Arr.data(), _Size) {} - - template , int> = 0> - constexpr explicit(_Extent != dynamic_extent) span(_Rng& _Range) - : _Mybase(_STD data(_Range), static_cast(_STD size(_Range))) { -#if _CONTAINER_DEBUG_LEVEL > 0 - if constexpr (_Extent != dynamic_extent) { - _STL_VERIFY(_STD size(_Range) == _Extent, - "Cannot construct span with static extent from range r as std::size(r) != extent"); - } -#endif // _CONTAINER_DEBUG_LEVEL > 0 - } - - template , int> = 0> - constexpr explicit(_Extent != dynamic_extent) span(const _Rng& _Range) - : _Mybase(_STD data(_Range), static_cast(_STD size(_Range))) { -#if _CONTAINER_DEBUG_LEVEL > 0 - if constexpr (_Extent != dynamic_extent) { - _STL_VERIFY(_STD size(_Range) == _Extent, - "Cannot construct span with static extent from range r as std::size(r) != extent"); - } -#endif // _CONTAINER_DEBUG_LEVEL > 0 - } - - template , - is_convertible<_OtherTy (*)[], element_type (*)[]>>, - int> = 0> - constexpr explicit(_Extent != dynamic_extent && _OtherExtent == dynamic_extent) - span(const span<_OtherTy, _OtherExtent>& _Other) noexcept - : _Mybase(_Other.data(), _Other.size()) { -#if _CONTAINER_DEBUG_LEVEL > 0 - if constexpr (_Extent != dynamic_extent) { - _STL_VERIFY(_Other.size() == _Extent, - "Cannot construct span with static extent from other span as other.size() != extent"); - } -#endif // _CONTAINER_DEBUG_LEVEL > 0 - } - -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ - // [span.sub] Subviews template _NODISCARD constexpr auto first() const noexcept /* strengthened */ { @@ -609,7 +489,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 +497,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 +507,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 +515,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,24 +535,12 @@ span(array<_Ty, _Size>&) -> span<_Ty, _Size>; template span(const array<_Ty, _Size>&) -> span; -#ifdef __cpp_lib_concepts - template span(_It, _End) -> span>>; template <_RANGES contiguous_range _Rng> span(_Rng&&) -> span>>; -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - -template -span(_Rng&) -> span; - -template -span(const _Rng&) -> span; - -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ - #ifdef __cpp_lib_byte // [span.objectrep] Views of object representation _EXPORT_STD template diff --git a/stl/inc/spanstream b/stl/inc/spanstream index af07689db0..264c85dd75 100644 --- a/stl/inc/spanstream +++ b/stl/inc/spanstream @@ -10,9 +10,7 @@ #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 #include -#endif // defined(__cpp_lib_concepts) #include #include #include @@ -215,14 +213,12 @@ public: _Mybase::set_rdbuf(_STD addressof(_Buf)); } -#ifdef __cpp_lib_concepts 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) basic_ispanstream& operator=(const basic_ispanstream&) = delete; @@ -251,7 +247,6 @@ public: rdbuf()->span(_Span); } -#ifdef __cpp_lib_concepts template <_RANGES borrowed_range _ReadOnlyRange> requires ( !convertible_to<_ReadOnlyRange, _STD span<_Elem>> && convertible_to<_ReadOnlyRange, _STD span>) @@ -259,7 +254,6 @@ public: this->span( _STD span<_Elem>{const_cast<_Elem*>(_RANGES data(_Range)), static_cast(_RANGES size(_Range))}); } -#endif // defined(__cpp_lib_concepts) private: _Mysb _Buf; diff --git a/stl/inc/stack b/stl/inc/stack index e311d6e72a..c1f012eec2 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,8 @@ 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 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_CXX23 template , int> = 0> @@ -79,11 +77,9 @@ public: is_nothrow_constructible_v<_Container, _InIt, _InIt, const _Alloc&>) // strengthened : c(_STD move(_First), _STD move(_Last), _Al) {} -#ifdef __cpp_lib_concepts 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_CXX23 _NODISCARD_EMPTY_ADAPTOR_MEMBER bool empty() const noexcept(noexcept(c.empty())) /* strengthened */ { @@ -110,7 +106,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 +115,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 +157,11 @@ 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 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_CXX23 _EXPORT_STD template @@ -200,13 +194,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..ff20cfb418 100644 --- a/stl/inc/stacktrace +++ b/stl/inc/stacktrace @@ -13,14 +13,11 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with #else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv #include +#include #include #include #include -#ifdef __cpp_lib_concepts -#include -#endif // __cpp_lib_concepts - #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) @@ -268,17 +265,7 @@ public: return _Result; } -#ifdef __cpp_lib_concepts return _STD lexicographical_compare_three_way(_Lhs.begin(), _Lhs.end(), _Rhs.begin(), _Rhs.end()); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) 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]; - } - } - - return strong_ordering::equal; -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ } void swap(basic_stacktrace& _Other) noexcept(allocator_traits<_Alloc>::propagate_on_container_swap::value @@ -352,7 +339,6 @@ ostream& operator<<(ostream& _Os, const basic_stacktrace<_Alloc>& _St) { return _Os << _STD to_string(_St); } -#ifdef __cpp_lib_concepts template <> struct formatter { constexpr format_parse_context::iterator parse(format_parse_context& _Parse_ctx) { @@ -386,7 +372,6 @@ struct formatter> { return _RANGES copy(_STD to_string(_Val), _Format_ctx.out()).out; } }; -#endif // __cpp_lib_concepts namespace pmr { _EXPORT_STD using stacktrace = basic_stacktrace>; diff --git a/stl/inc/system_error b/stl/inc/system_error index bb3f657964..11d180314c 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -104,17 +104,15 @@ public: #endif // ^^^ !defined(_M_CEE_PURE) ^^^ } -#if !_HAS_CXX20 +#if _HAS_CXX20 + _NODISCARD strong_ordering operator<=>(const error_category& _Right) const noexcept { + return _Bit_cast(_Addr) <=> _Bit_cast(_Right._Addr); + } +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv _NODISCARD bool operator!=(const error_category& _Right) const noexcept { return !(*this == _Right); } -#endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts - _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 _NODISCARD bool operator<(const error_category& _Right) const noexcept { #ifdef _M_CEE_PURE return _Addr < _Right._Addr; @@ -122,7 +120,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,20 +220,18 @@ 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) ^^^ -#if !_HAS_CXX20 _NODISCARD_FRIEND bool operator==(const error_condition& _Left, const error_code& _Right) noexcept { return _System_error_equal(_Right, _Left); } @@ -251,7 +247,7 @@ public: _NODISCARD_FRIEND bool operator!=(const error_condition& _Left, const error_code& _Right) noexcept { return !_System_error_equal(_Right, _Left); } -#endif // !_HAS_CXX20 +#endif // ^^^ !_HAS_CXX20 ^^^ #endif // _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS private: @@ -309,7 +305,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,17 +313,15 @@ 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) ^^^ -#if !_HAS_CXX20 _NODISCARD_FRIEND bool operator!=(const error_condition& _Left, const error_condition& _Right) noexcept { return !(_Left == _Right); } -#endif // !_HAS_CXX20 +#endif // ^^^ !_HAS_CXX20 ^^^ // We grant friendship to the operators from error_code here to allow is_error_code_enum_v but not // is_error_condition_enum_v enums to be compared directly with error_condition; for example: @@ -362,7 +356,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 +371,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,9 +381,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) ^^^ -#if !_HAS_CXX20 _NODISCARD inline bool operator==(const error_condition& _Left, const error_code& _Right) noexcept { return _Right.category().equivalent(_Right.value(), _Left) || _Left.category().equivalent(_Right, _Left.value()); } @@ -409,7 +401,7 @@ _NODISCARD inline bool operator!=(const error_condition& _Left, const error_code _NODISCARD inline bool operator!=(const error_condition& _Left, const error_condition& _Right) noexcept { return !(_Left == _Right); } -#endif // !_HAS_CXX20 +#endif // ^^^ !_HAS_CXX20 ^^^ #endif // ^^^ !_STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS ^^^ _NODISCARD inline error_condition error_category::default_error_condition(int _Errval) const 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 3f1f58cb47..8a5df17a95 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,6 @@ public: return *this; } -#ifdef __cpp_lib_concepts template <_Different_from _Other> requires _Tuple_like<_Other> && (tuple_size_v> == 0) constexpr tuple& operator=(_Other&&) noexcept /* strengthened */ { @@ -267,7 +266,6 @@ public: constexpr const tuple& operator=(_Other&&) const noexcept /* strengthened */ { return *this; } -#endif // defined(__cpp_lib_concepts) #endif // _HAS_CXX23 _CONSTEXPR20 void swap(tuple&) noexcept {} @@ -279,17 +277,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 +299,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 +421,6 @@ public: _Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} -#ifdef __cpp_lib_concepts template > static constexpr bool _Is_tuple_like_constructor_explicit_v = false; @@ -444,7 +441,6 @@ 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_CXX23 template && _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} -#ifdef __cpp_lib_concepts -#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 and VSO-1900279 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 (Clang), VSO-1900279 (EDG) template , int> = 0> #else // ^^^ workaround / no workaround vvv template _Other> @@ -553,7 +548,6 @@ 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_CXX23 tuple& operator=(const volatile tuple&) = delete; @@ -689,7 +683,6 @@ public: return *this; } -#ifdef __cpp_lib_concepts template > static constexpr bool _Can_assign_values_from_tuple_like_v = false; @@ -730,7 +723,6 @@ public: _Assign_tuple_like(_STD forward<_Other>(_Right), make_index_sequence<1 + sizeof...(_Rest)>{}); return *this; } -#endif // defined(__cpp_lib_concepts) #endif // _HAS_CXX23 _CONSTEXPR20 void swap(tuple& _Right) noexcept( @@ -763,7 +755,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 +805,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,19 +867,17 @@ _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 -#if !_HAS_CXX20 +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD constexpr bool operator!=(const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { return !(_Left == _Right); } -#endif // !_HAS_CXX20 template _NODISCARD constexpr bool operator<(const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { @@ -909,7 +899,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 +1030,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 +1043,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 +1057,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 +1067,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 +1079,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 +1092,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 +1108,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 +1154,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 0d121913bf..2fde17906d 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -2236,7 +2236,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 @@ -2264,7 +2264,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 7578cf0041..8442f53c23 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -10,12 +10,9 @@ #include #include -#ifdef __cpp_lib_concepts -#include -#endif // defined(__cpp_lib_concepts) - #if _HAS_CXX20 #include +#include #endif // _HAS_CXX20 #if _HAS_CXX23 @@ -185,7 +182,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 +213,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__) || defined(__EDG__) #endif // _HAS_CXX23 -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template struct pair { // store a pair of values @@ -288,8 +285,7 @@ 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 -#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 and VSO-1900279 +#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 +300,6 @@ 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_CXX23 template @@ -417,7 +412,6 @@ struct pair { // store a pair of values return *this; } -#ifdef __cpp_lib_concepts 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 +435,6 @@ struct pair { // store a pair of values second = _STD get<1>(_STD forward<_Other>(_Right)); return *this; } -#endif // defined(__cpp_lib_concepts) #endif // _HAS_CXX23 _CONSTEXPR20 void swap(pair& _Right) noexcept( @@ -494,7 +487,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,13 +497,11 @@ _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 -#if !_HAS_CXX20 +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template _NODISCARD constexpr bool operator!=(const pair<_Ty1, _Ty2>& _Left, const pair<_Uty1, _Uty2>& _Right) { return !(_Left == _Right); } -#endif // !_HAS_CXX20 template _NODISCARD constexpr bool operator<(const pair<_Ty1, _Ty2>& _Left, const pair<_Uty1, _Uty2>& _Right) { @@ -531,9 +522,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 +539,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 01293cec40..95426be8ed 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; @@ -629,12 +629,12 @@ public: const auto _Length = static_cast(_STD distance(_UFirst, _ULast)); const auto _Count = _STD _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 = _STD _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _STD _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); @@ -652,7 +652,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) { @@ -671,7 +671,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())) { @@ -886,7 +886,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 @@ -943,10 +943,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>) { @@ -957,7 +957,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) { @@ -1235,19 +1235,19 @@ public: const auto _Length = static_cast(_STD distance(_UFirst, _ULast)); const auto _Count = _STD _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 = _STD _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; @@ -1269,7 +1269,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; @@ -1444,18 +1444,18 @@ public: const auto _Length = static_cast(_STD distance(_UFirst, _ULast)); const auto _Count = _STD _Convert_size(_Length); _Assign_counted_range(_UFirst, _Count); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 } else if constexpr (forward_iterator<_Iter>) { const auto _Length = _STD _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _STD _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>) { @@ -1466,7 +1466,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()); @@ -2208,11 +2208,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; @@ -2263,11 +2263,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 @@ -2276,15 +2276,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) { @@ -2309,7 +2309,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>) { @@ -2351,7 +2351,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 */ { @@ -2901,7 +2901,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>) { @@ -2912,7 +2912,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); @@ -3238,12 +3238,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); @@ -3255,7 +3255,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()); @@ -3313,7 +3313,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(); @@ -3340,13 +3340,13 @@ public: const auto _Count = _STD _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 = _STD _To_unsigned_like(_RANGES distance(_UFirst, _ULast)); const auto _Count = _STD _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) { @@ -3361,7 +3361,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(); @@ -3386,7 +3386,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); @@ -3575,7 +3575,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> { @@ -3593,7 +3593,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 a2f8ded5e7..e36e68e5e0 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -958,12 +958,12 @@ public: _Insert_range_unchecked(_STD _Get_unwrapped(_First), _STD _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 2839843709..1e524c0b1d 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -495,17 +495,8 @@ struct _Is_default_allocator, void_t::_Fr : is_same::_From_primary, allocator<_Ty>>::type {}; #if _HAS_CXX23 -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 template concept _Has_member_allocate_at_least = requires(_Alloc& _Al, const _SizeTy& _Count) { _Al.allocate_at_least(_Count); }; -#else // ^^^ no workaround / workaround vvv -template -inline constexpr bool _Has_member_allocate_at_least = false; - -template -inline constexpr bool _Has_member_allocate_at_least<_Alloc, _SizeTy, - void_t().allocate_at_least(_STD declval()))>> = true; -#endif // ^^^ workaround ^^^ #endif // _HAS_CXX23 template @@ -1671,7 +1662,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 = @@ -1805,7 +1796,7 @@ namespace ranges { } } } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 template class _NODISCARD _Uninitialized_backout_al { @@ -1847,15 +1838,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 = _STD _Get_unwrapped(_STD move(_First)); auto _ULast = _STD _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; @@ -2385,13 +2376,13 @@ _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 +#else // ^^^ _HAS_CXX23 / !_HAS_CXX23 vvv _EXPORT_STD template && !_Is_deducible_as_pair<_Uty&>, int> = 0> -#endif // ^^^ C++20 or no concepts ^^^ +#endif // ^^^ !_HAS_CXX23 ^^^ _NODISCARD constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _Uty&& _Ux) noexcept; _EXPORT_STD template , int> = 0> @@ -2476,15 +2467,15 @@ _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 +#else // ^^^ _HAS_CXX23 / !_HAS_CXX23 vvv _EXPORT_STD template && !_Is_deducible_as_pair<_Uty&>, int> /* = 0 */> -#endif // ^^^ C++20 or no concepts ^^^ +#endif // ^^^ !_HAS_CXX23 ^^^ _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, @@ -2495,7 +2486,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; @@ -2547,7 +2538,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; }; @@ -2566,7 +2557,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>> @@ -2633,10 +2624,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 c34ee4fd0e..2815ac3092 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); @@ -3935,7 +3935,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) { _STD _Adl_verify_range(_First, _Last); @@ -3953,7 +3953,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)); @@ -4917,12 +4917,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 ce5f7eabf9..63d4e1224d 100644 --- a/stl/inc/xtree +++ b/stl/inc/xtree @@ -1260,12 +1260,12 @@ public: _Insert_range_unchecked(_STD _Get_unwrapped(_First), _STD _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 6175050243..308d83d0de 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -311,20 +311,11 @@ struct pointer_traits<_Ty*> { }; #if _HAS_CXX20 -#ifdef __cpp_lib_concepts template concept _Has_to_address = requires(const _Ty& _Val) { typename pointer_traits<_Ty>; pointer_traits<_Ty>::to_address(_Val); }; -#else // ^^^ no workaround / workaround vvv -template -inline constexpr bool _Has_to_address = false; // determines whether pointer_traits<_Ty> has to_address - -template -inline constexpr bool - _Has_to_address<_Ty, void_t::to_address(_STD declval()))>> = true; -#endif // ^^^ workaround ^^^ _EXPORT_STD template _NODISCARD constexpr _Ty* to_address(_Ty* const _Val) noexcept { @@ -597,7 +588,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 +1037,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 +1049,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 +1071,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 +1081,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 +1091,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 +1101,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 +1489,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 +1512,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 +1545,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 +1609,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 +1629,7 @@ public: --_RTmp; _RANGES iter_swap(_LTmp, _RTmp); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using _Prevent_inheriting_unwrap = reverse_iterator; @@ -1684,11 +1675,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator==(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_STD _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 +1688,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator!=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_STD _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 +1701,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_STD _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 +1714,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_STD _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 +1727,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_STD _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 +1740,23 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( noexcept(_STD _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 +1778,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 +1953,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>>; @@ -3943,14 +3934,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; @@ -3963,12 +3954,12 @@ struct _Move_iterator_category<_Iter> { using iterator_category = conditional_t, random_access_iterator_tag>, random_access_iterator_tag, _Iter_cat_t<_Iter>>; }; -#else // ^^^ Ranges / no Ranges vvv +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template struct _Move_iterator_category { using iterator_category = _Iter_cat_t<_Iter>; }; -#endif // ^^^ no Ranges ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _EXPORT_STD template class move_iterator : public _Move_iterator_category<_Iter> { @@ -3981,7 +3972,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>) { @@ -3999,10 +3990,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; @@ -4010,49 +4001,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 */ { @@ -4066,17 +4057,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 */ { @@ -4126,16 +4117,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( @@ -4165,18 +4156,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; @@ -4220,11 +4211,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator==(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept( noexcept(_STD _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(); } @@ -4241,11 +4232,11 @@ _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept( noexcept(_STD _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(); } @@ -4253,9 +4244,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; } @@ -4263,9 +4254,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); } @@ -4273,20 +4264,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, @@ -4299,11 +4290,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); } @@ -4314,7 +4305,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; @@ -4331,12 +4322,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>; @@ -4346,7 +4337,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>; @@ -4356,7 +4347,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 { @@ -4445,9 +4436,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()) { @@ -4519,9 +4510,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 @@ -4541,11 +4532,11 @@ _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 +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv is_same_v<_Sent, _InIt>, -#endif // ^^^ no Concepts ^^^ +#endif // ^^^ !_HAS_CXX20 ^^^ _Iter_copy_cat<_InIt, _OutIt>, _False_trivial_cat>; template @@ -4560,11 +4551,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 _STD _Copy_memmove_n(_First, static_cast(_Last - _First), _Dest); } else -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 { return _STD _Copy_memmove(_First, _Last, _Dest); } @@ -4600,7 +4591,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>; @@ -4742,7 +4733,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) { @@ -5086,7 +5077,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: @@ -5121,7 +5112,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; @@ -5185,12 +5176,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. @@ -5325,7 +5316,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) { @@ -5456,7 +5447,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>, @@ -5498,7 +5489,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>; @@ -5508,7 +5499,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 = @@ -5579,7 +5570,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; @@ -5666,7 +5657,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 {}; @@ -5821,7 +5812,7 @@ _EXPORT_STD template concept _Sized_or_unreachable_sentinel_for = sized_sentinel_for<_Se, _It> || same_as<_Se, unreachable_sentinel_t>; @@ -5930,7 +5921,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) { @@ -6279,7 +6270,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) { @@ -6580,7 +6571,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? @@ -6588,9 +6579,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 @@ -6651,7 +6642,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) { @@ -6712,7 +6703,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 @@ -6728,7 +6719,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? @@ -6785,7 +6776,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 @@ -6845,7 +6836,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) { @@ -6906,7 +6897,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 @@ -6922,7 +6913,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: @@ -6973,7 +6964,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) { @@ -7130,7 +7121,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__ @@ -7200,7 +7191,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_000140_adl_proof_comparison/test.compile.pass.cpp b/tests/std/tests/GH_000140_adl_proof_comparison/test.compile.pass.cpp index 003d16eada..0f79ab7635 100644 --- a/tests/std/tests/GH_000140_adl_proof_comparison/test.compile.pass.cpp +++ b/tests/std/tests/GH_000140_adl_proof_comparison/test.compile.pass.cpp @@ -12,13 +12,13 @@ #include #endif // _HAS_CXX17 -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 #include -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#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 using namespace std; @@ -81,9 +81,9 @@ struct validating_iterator_provider::iterator { using reference = T&; using difference_type = ptrdiff_t; using iterator_category = random_access_iterator_tag; -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 using iterator_concept = contiguous_iterator_tag; -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 constexpr T& operator*() const noexcept { return *ptr_; @@ -228,13 +228,13 @@ void test_adl_proof_move_iterator_comparison() { test_adl_proof_comparison(); test_adl_proof_comparison(); -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 I i{}; move_sentinel::iterator> s{}; (void) (i == s); (void) (i != s); -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 } #if _HAS_CXX17 @@ -248,7 +248,7 @@ void test_adl_proof_optional_comparison() { } #endif // _HAS_CXX17 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 void test_adl_proof_expected_comparison() { expected ex; (void) (ex == ex); @@ -286,6 +286,6 @@ void test_adl_proof_basic_const_iterator_comparison() { test_adl_proof_comparison(); test_adl_proof_comparison(); } -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 #endif // _M_CEE 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..b01b0b8b56 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 +#endif // _HAS_CXX20 } -#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..d98a62588f 100644 --- a/tests/std/tests/GH_000545_include_compare/test_ranges.cpp +++ b/tests/std/tests/GH_000545_include_compare/test_ranges.cpp @@ -1,15 +1,10 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include // TRANSITION, GH-395 -#ifdef __cpp_lib_concepts - #include // Testing LWG-3330 "Include from most library headers" by intentionally NOT including static_assert(std::is_eq(std::partial_ordering::equivalent)); -#endif // __cpp_lib_concepts - 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 12a478f418..07ed0ee1e3 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 @@ -337,10 +337,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 // (void) std::next_permutation(varr, varr); // requires Cpp17ValueSwappable (void) std::next_permutation(iarr, iarr, validating_less{}); @@ -532,7 +532,7 @@ void test_parallel_algorithms() { } #endif // _HAS_CXX17 -#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX20 void test_ranges_non_projected_algorithms() { using namespace std::ranges; @@ -631,5 +631,5 @@ void test_ranges_non_projected_algorithms() { (void) shift_right(varr, 0); #endif // _HAS_CXX23 } -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _M_CEE diff --git a/tests/std/tests/GH_002030_asan_annotate_string/test.cpp b/tests/std/tests/GH_002030_asan_annotate_string/test.cpp index bf788feb2f..7b5259955a 100644 --- a/tests/std/tests/GH_002030_asan_annotate_string/test.cpp +++ b/tests/std/tests/GH_002030_asan_annotate_string/test.cpp @@ -89,9 +89,7 @@ template constexpr auto get_sso_input_view() { return basic_string_view{get_sso_input()}; } -#endif // _HAS_CXX17 -#if _HAS_CXX17 template struct string_view_convertible { constexpr operator basic_string_view() const noexcept { 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/GH_004109_iter_value_t_direct_initialization/test.compile.pass.cpp b/tests/std/tests/GH_004109_iter_value_t_direct_initialization/test.compile.pass.cpp index 08520f59bf..99a3593c6a 100644 --- a/tests/std/tests/GH_004109_iter_value_t_direct_initialization/test.compile.pass.cpp +++ b/tests/std/tests/GH_004109_iter_value_t_direct_initialization/test.compile.pass.cpp @@ -69,10 +69,10 @@ struct I { #endif // ^^^ workaround ^^^ }; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 static_assert(random_access_iterator); static_assert(sortable); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 extern Val val; extern mt19937 urbg; // UniformRandomBitGenerator @@ -90,9 +90,9 @@ void test_gh_4109() { #endif // _HAS_AUTO_PTR_ETC Val (*unop)(Val) = nullptr; Val (*binop)(Val, Val) = nullptr; -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 strong_ordering (*comp_three_way)(Val, Val) = nullptr; -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 (void) all_of(nil, nil, pred); (void) any_of(nil, nil, pred); @@ -230,10 +230,10 @@ void test_gh_4109() { (void) minmax_element(nil, nil, comp); (void) lexicographical_compare(nil, nil, nil, nil); (void) lexicographical_compare(nil, nil, nil, nil, comp); -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 (void) lexicographical_compare_three_way(nil, nil, nil, nil); (void) lexicographical_compare_three_way(nil, nil, nil, nil, comp_three_way); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 next_permutation(nil, nil); next_permutation(nil, nil, comp); prev_permutation(nil, nil); @@ -395,7 +395,7 @@ void test_gh_4109() { uninitialized_fill_n(par, nil, zero, val); #endif // __cpp_lib_execution -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 // Non-modifying sequence operations (void) ranges::all_of(nil, nil, pred); (void) ranges::any_of(nil, nil, pred); @@ -557,5 +557,5 @@ void test_gh_4109() { ranges::uninitialized_move_n(nil, zero, nil, nil); ranges::uninitialized_fill(nil, nil, val); ranges::uninitialized_fill_n(nil, zero, val); -#endif // __cpp_lib_concepts +#endif // _HAS_CXX20 } diff --git a/tests/std/tests/P0122R7_span/test.cpp b/tests/std/tests/P0122R7_span/test.cpp index 176df595bd..a3d47462b1 100644 --- a/tests/std/tests/P0122R7_span/test.cpp +++ b/tests/std/tests/P0122R7_span/test.cpp @@ -6,14 +6,11 @@ #include #include #include +#include #include #include #include -#ifdef __cpp_lib_concepts -#include -#endif // __cpp_lib_concepts - using namespace std; static_assert(is_same_v); @@ -74,10 +71,8 @@ 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 static_assert(ranges::enable_borrowed_range>); static_assert(ranges::enable_borrowed_range>); -#endif // __cpp_lib_concepts // N4901 [span.overview]/3 static_assert(is_trivially_copyable_v>); @@ -145,12 +140,10 @@ struct BasicRange { } }; -#ifdef __cpp_lib_concepts namespace std::ranges { template inline constexpr bool enable_borrowed_range> = Borrowed; } -#endif // __cpp_lib_concepts using ContiguousSizedRange = BasicRange; @@ -247,7 +240,6 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#ifdef __cpp_lib_concepts 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 +284,6 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#endif // __cpp_lib_concepts } { @@ -351,7 +342,6 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#ifdef __cpp_lib_concepts static_assert(is_nothrow_constructible_v, int*, const int*>); // strengthened static_assert(is_nothrow_constructible_v, int*, const int*>); // strengthened @@ -456,7 +446,6 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); static_assert(is_same_v>); -#endif // __cpp_lib_concepts } { @@ -619,7 +608,6 @@ constexpr bool test() { FunctionTakingSpan(user_range); FunctionTakingSpan(as_const(user_range)); -#ifdef __cpp_lib_concepts static_assert(!is_constructible_v, ContiguousSizedRange>); static_assert(!is_constructible_v, ContiguousSizedRange>); static_assert(is_constructible_v, BorrowedContiguousSizedRange>); @@ -654,7 +642,6 @@ constexpr bool test() { static_assert(is_same_v>); static_assert(is_same_v>); -#endif // __cpp_lib_concepts } { diff --git a/tests/std/tests/P0220R1_optional/test.cpp b/tests/std/tests/P0220R1_optional/test.cpp index 9d760fe8ed..853936a664 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 >); @@ -144,7 +144,7 @@ static_assert(!std::indirectly_movable, std::optional>); static_assert(!std::indirectly_movable_storable, std::optional>); static_assert(!std::indirectly_copyable, std::optional>); static_assert(!std::indirectly_copyable_storable, std::optional>); -#endif // TRANSITION, GH-395 +#endif // _HAS_CXX20 // -- END: test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp // -- BEGIN: test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp @@ -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..a0b24b0b32 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,6 @@ constexpr bool test_leap_second() { static_assert(noexcept(equal >= leap)); static_assert(noexcept(leap >= equal)); -#ifdef __cpp_lib_concepts static_assert(is_eq(leap <=> equal)); static_assert(is_lt(leap <=> larger)); static_assert(is_gt(leap <=> smaller)); @@ -172,7 +171,6 @@ 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 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..dc509bea95 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,18 @@ void timezone_names_test() { const time_zone tz3{_Secret_time_zone_construct_tag{}, "Later"}; assert(tz1 == tz2); assert(tz1 != tz3); -#ifdef __cpp_lib_concepts assert(tz1 <=> tz2 == strong_ordering::equal); assert(tz1 <=> tz3 == strong_ordering::less); assert(tz3 <=> tz1 == strong_ordering::greater); -#endif // __cpp_lib_concepts 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 assert(link1 <=> link2 == strong_ordering::equal); assert(link1 <=> link3 == strong_ordering::less); assert(link3 <=> link1 == strong_ordering::greater); -#endif // __cpp_lib_concepts 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..d8ce3cb83c 100644 --- a/tests/std/tests/P0401R6_allocate_at_least/test.cpp +++ b/tests/std/tests/P0401R6_allocate_at_least/test.cpp @@ -3,9 +3,7 @@ #include #include -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 #include -#endif // __cpp_lib_concepts #include #include #include @@ -78,12 +76,7 @@ constexpr bool test() { { allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 same_as> auto result = al.allocate_at_least(5); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - auto result = al.allocate_at_least(5); - static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ assert(result.ptr); assert(result.count >= 5); al.deallocate(result.ptr, 5); @@ -102,12 +95,7 @@ constexpr bool test() { { generous_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - auto result = allocator_traits::allocate_at_least(al, 4); - static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ assert(result.ptr); assert(result.count == 16); al.deallocate(result.ptr, result.count); @@ -116,12 +104,7 @@ constexpr bool test() { { strict_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - auto result = allocator_traits::allocate_at_least(al, 4); - static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ assert(result.ptr); assert(result.count == 4); al.deallocate(result.ptr, result.count); @@ -130,13 +113,8 @@ constexpr bool test() { { small_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - auto result = allocator_traits::allocate_at_least(al, 4); - static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ assert(result.ptr); assert(result.count == 4); al.deallocate(result.ptr, result.count); @@ -145,13 +123,8 @@ constexpr bool test() { { huge_allocator al; -#ifdef __cpp_lib_concepts // TRANSITION, GH-395 same_as> auto result = allocator_traits::allocate_at_least(al, 4); -#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - auto result = allocator_traits::allocate_at_least(al, 4); - static_assert(is_same_v>); -#endif // ^^^ !defined(__cpp_lib_concepts) ^^^ 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..02de419f82 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