diff --git a/.github/workflows/update-status-chart.yml b/.github/workflows/update-status-chart.yml index 56f60194068..8e559d18a21 100644 --- a/.github/workflows/update-status-chart.yml +++ b/.github/workflows/update-status-chart.yml @@ -6,6 +6,8 @@ on: schedule: - cron: "0 7 * * *" workflow_dispatch: +permissions: + contents: write jobs: build: if: ${{ github.repository == 'microsoft/STL' }} diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 3857d4c1e2c..1a5071ea583 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -61,6 +61,9 @@ endif() set(CMAKE_BUILD_TYPE RelWithDebInfo) +# /utf-8 affects . +add_compile_options("$<$:/diagnostics:caret;/W4;/WX;/w14265;/w15038;/w15262;/utf-8>") + if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/google-benchmark/.git") message(FATAL_ERROR "google-benchmark is not checked out; make sure to run\n git submodule update --init benchmarks/google-benchmark") endif() @@ -107,6 +110,7 @@ endfunction() add_benchmark(bitset_to_string src/bitset_to_string.cpp) add_benchmark(locale_classic src/locale_classic.cpp) +add_benchmark(minmax_element src/minmax_element.cpp) add_benchmark(path_lexically_normal src/path_lexically_normal.cpp) add_benchmark(priority_queue_push_range src/priority_queue_push_range.cpp) add_benchmark(random_integer_generation src/random_integer_generation.cpp) diff --git a/benchmarks/inc/udt.hpp b/benchmarks/inc/udt.hpp index b47c58c2c9d..15e6e07f1d9 100644 --- a/benchmarks/inc/udt.hpp +++ b/benchmarks/inc/udt.hpp @@ -3,18 +3,18 @@ #pragma once -template +template struct aggregate { - Contained c; + Data c; friend bool operator==(const aggregate&, const aggregate&) = default; }; -template +template struct non_trivial { - Contained c; + Data c; non_trivial() : c() {} - non_trivial(const Contained& src) : c(src) {} + non_trivial(const Data& src) : c(src) {} non_trivial(const non_trivial& other) : c(other.c) {} non_trivial& operator=(const non_trivial& other) { c = other.c; diff --git a/benchmarks/inc/utility.hpp b/benchmarks/inc/utility.hpp index e407e2654c3..b74b4078ca9 100644 --- a/benchmarks/inc/utility.hpp +++ b/benchmarks/inc/utility.hpp @@ -18,6 +18,15 @@ std::vector random_vector(size_t n) { xoshiro256ss prng{id64(rd), id64(rd), id64(rd), id64(rd)}; std::vector res(n); + +// Here, the type Contained can be char, int, aggregate, or non_trivial where Data is char or int. +// (aggregate and non_trivial are defined in udt.hpp.) +// static_cast silences truncation warnings when Contained is directly char or int, +// but is insufficient for aggregate or non_trivial. +#pragma warning(push) +#pragma warning(disable : 4244) // warning C4244: conversion from 'uint64_t' to 'Data', possible loss of data std::generate(res.begin(), res.end(), [&prng] { return static_cast(prng.next()); }); +#pragma warning(pop) + return res; } diff --git a/benchmarks/src/minmax_element.cpp b/benchmarks/src/minmax_element.cpp new file mode 100644 index 00000000000..da6cf9aff4a --- /dev/null +++ b/benchmarks/src/minmax_element.cpp @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include +#include +#include +#include + +enum class Op { + Min, + Max, + Both, +}; + +using namespace std; + +template +void bm(benchmark::State& state) { + T a[Size]; + + mt19937 gen(84710); + + if constexpr (is_floating_point_v) { + normal_distribution dis(0, 10000.0); + ranges::generate(a, [&] { return dis(gen); }); + } else { + uniform_int_distribution> dis(1, 20); + ranges::generate(a, [&] { return static_cast(dis(gen)); }); + } + + for (auto _ : state) { + if constexpr (Operation == Op::Min) { + benchmark::DoNotOptimize(ranges::min_element(a)); + } else if constexpr (Operation == Op::Max) { + benchmark::DoNotOptimize(ranges::max_element(a)); + } else if constexpr (Operation == Op::Both) { + benchmark::DoNotOptimize(ranges::minmax_element(a)); + } + } +} + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + +BENCHMARK(bm); +BENCHMARK(bm); +BENCHMARK(bm); + + +BENCHMARK_MAIN(); diff --git a/benchmarks/src/std/containers/sequences/vector.bool/copy/test.cpp b/benchmarks/src/std/containers/sequences/vector.bool/copy/test.cpp index c5c0777526b..18e18244514 100644 --- a/benchmarks/src/std/containers/sequences/vector.bool/copy/test.cpp +++ b/benchmarks/src/std/containers/sequences/vector.bool/copy/test.cpp @@ -4,6 +4,7 @@ #include // #include +#include #include #include @@ -17,7 +18,7 @@ static vector createRandomVector(const size_t size) { } static void copy_block_aligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -27,7 +28,7 @@ static void copy_block_aligned(benchmark::State& state) { } static void copy_source_misaligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -37,7 +38,7 @@ static void copy_source_misaligned(benchmark::State& state) { } static void copy_dest_misaligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -48,7 +49,7 @@ static void copy_dest_misaligned(benchmark::State& state) { // Special benchmark for matching char alignment static void copy_matching_alignment(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); diff --git a/benchmarks/src/std/containers/sequences/vector.bool/copy_n/test.cpp b/benchmarks/src/std/containers/sequences/vector.bool/copy_n/test.cpp index 5a4babf5c54..fe52c7036cf 100644 --- a/benchmarks/src/std/containers/sequences/vector.bool/copy_n/test.cpp +++ b/benchmarks/src/std/containers/sequences/vector.bool/copy_n/test.cpp @@ -4,6 +4,7 @@ #include // #include +#include #include #include @@ -17,7 +18,7 @@ static vector createRandomVector(const size_t size) { } static void copy_n_block_aligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -27,7 +28,7 @@ static void copy_n_block_aligned(benchmark::State& state) { } static void copy_n_source_misaligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -37,7 +38,7 @@ static void copy_n_source_misaligned(benchmark::State& state) { } static void copy_n_dest_misaligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -48,7 +49,7 @@ static void copy_n_dest_misaligned(benchmark::State& state) { // Special benchmark for matching char alignment static void copy_n_matching_alignment(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); diff --git a/benchmarks/src/std/containers/sequences/vector.bool/move/test.cpp b/benchmarks/src/std/containers/sequences/vector.bool/move/test.cpp index db797917885..7eefc268ec2 100644 --- a/benchmarks/src/std/containers/sequences/vector.bool/move/test.cpp +++ b/benchmarks/src/std/containers/sequences/vector.bool/move/test.cpp @@ -4,6 +4,7 @@ #include // #include +#include #include #include @@ -17,7 +18,7 @@ static vector createRandomVector(const size_t size) { } static void move_block_aligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -27,7 +28,7 @@ static void move_block_aligned(benchmark::State& state) { } static void move_source_misaligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -37,7 +38,7 @@ static void move_source_misaligned(benchmark::State& state) { } static void move_dest_misaligned(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); @@ -48,7 +49,7 @@ static void move_dest_misaligned(benchmark::State& state) { // Special benchmark for matching char alignment static void move_matching_alignment(benchmark::State& state) { - const auto size = state.range(0); + const auto size = static_cast(state.range(0)); const vector source = createRandomVector(size); vector dest(size, false); diff --git a/stl/inc/__msvc_bit_utils.hpp b/stl/inc/__msvc_bit_utils.hpp index febf026e595..ca2fec13d1a 100644 --- a/stl/inc/__msvc_bit_utils.hpp +++ b/stl/inc/__msvc_bit_utils.hpp @@ -177,7 +177,7 @@ _NODISCARD int _Checked_arm_arm64_countl_zero(const _Ty _Val) noexcept { } else { return static_cast(_CountLeadingZeros64(_Val)); } -#endif // TRANSITION, GH-1586 +#endif // ^^^ no workaround ^^^ } #endif // defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64) #endif // _HAS_COUNTL_ZERO_INTRINSICS @@ -376,19 +376,19 @@ constexpr decltype(auto) _Select_countr_zero_impl(_Fn _Callback) { #if _HAS_TZCNT_BSF_INTRINSICS && _HAS_CXX20 if (!_STD is_constant_evaluated()) { #ifdef __AVX2__ - return _Callback([](_Ty _Val) { return _Countr_zero_tzcnt(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_tzcnt(_Val); }); #else // ^^^ AVX2 / not AVX2 vvv const bool _Definitely_have_tzcnt = __isa_available >= _Stl_isa_available_avx2; if (_Definitely_have_tzcnt) { - return _Callback([](_Ty _Val) { return _Countr_zero_tzcnt(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_tzcnt(_Val); }); } else { - return _Callback([](_Ty _Val) { return _Countr_zero_bsf(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_bsf(_Val); }); } #endif // ^^^ not AVX2 ^^^ } #endif // ^^^ _HAS_TZCNT_BSF_INTRINSICS && _HAS_CXX20 ^^^ // C++17 constexpr gcd() calls this function, so it should be constexpr unless we detect runtime evaluation. - return _Callback([](_Ty _Val) { return _Countr_zero_fallback(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_fallback(_Val); }); } template , int> = 0> @@ -420,16 +420,16 @@ _CONSTEXPR20 decltype(auto) _Select_popcount_impl(_Fn _Callback) { #ifndef __AVX__ const bool _Definitely_have_popcnt = __isa_available >= _Stl_isa_available_sse42; if (!_Definitely_have_popcnt) { - return _Callback([](_Ty _Val) { return _Popcount_fallback(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Popcount_fallback(_Val); }); } #endif // !defined(__AVX__) - return _Callback([](_Ty _Val) { return _Unchecked_x86_x64_popcount(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Unchecked_x86_x64_popcount(_Val); }); #elif _HAS_NEON_INTRINSICS // ^^^ x86/x64 intrinsics available / ARM64 intrinsics available vvv - return _Callback([](_Ty _Val) { return _Arm64_popcount(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Arm64_popcount(_Val); }); #endif // ^^^ ARM64 intrinsics available ^^^ } #endif // ^^^ any intrinsics available ^^^ - return _Callback([](_Ty _Val) { return _Popcount_fallback(_Val); }); + return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Popcount_fallback(_Val); }); } #undef _HAS_POPCNT_INTRINSICS diff --git a/stl/inc/__msvc_chrono.hpp b/stl/inc/__msvc_chrono.hpp index 265522d305f..8da26708e58 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_filebuf.hpp b/stl/inc/__msvc_filebuf.hpp index f64c9233391..9f6738be1b8 100644 --- a/stl/inc/__msvc_filebuf.hpp +++ b/stl/inc/__msvc_filebuf.hpp @@ -383,7 +383,7 @@ class basic_filebuf : public basic_streambuf<_Elem, _Traits> { // stream buffer } } -#if defined(__cpp_lib_print) && defined(_CPPRTTI) +#if _HAS_CXX23 && defined(_CPPRTTI) template friend ios_base::iostate _Print_noformat_unicode(ostream&, string_view); #endif diff --git a/stl/inc/__msvc_formatter.hpp b/stl/inc/__msvc_formatter.hpp index afba40829b4..5d4232d99e7 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 146f2f85cb9..6934fe27f9a 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 b3dc4d2c28f..6e6ff115103 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 @@ -408,7 +408,7 @@ concept weakly_incrementable = movable<_Ty> } #ifdef __clang__ // TRANSITION, LLVM-48173 && !same_as<_Ty, bool> -#endif // TRANSITION, LLVM-48173 +#endif // ^^^ workaround ^^^ ; _EXPORT_STD 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 ef02ef726cc..edaedc8f3de 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/__msvc_tzdb.hpp b/stl/inc/__msvc_tzdb.hpp index 7bed2d44549..43fc7e53b6a 100644 --- a/stl/inc/__msvc_tzdb.hpp +++ b/stl/inc/__msvc_tzdb.hpp @@ -101,28 +101,28 @@ struct _Tzdb_deleter; template <> struct _Tzdb_deleter<__std_tzdb_time_zones_info> { - void operator()(__std_tzdb_time_zones_info* _Info) const noexcept { + _STATIC_CALL_OPERATOR void operator()(__std_tzdb_time_zones_info* _Info) _CONST_CALL_OPERATOR noexcept { __std_tzdb_delete_time_zones(_Info); } }; template <> struct _Tzdb_deleter<__std_tzdb_current_zone_info> { - void operator()(__std_tzdb_current_zone_info* _Info) const noexcept { + _STATIC_CALL_OPERATOR void operator()(__std_tzdb_current_zone_info* _Info) _CONST_CALL_OPERATOR noexcept { __std_tzdb_delete_current_zone(_Info); } }; template <> struct _Tzdb_deleter<__std_tzdb_sys_info> { - void operator()(__std_tzdb_sys_info* _Info) const noexcept { + _STATIC_CALL_OPERATOR void operator()(__std_tzdb_sys_info* _Info) _CONST_CALL_OPERATOR noexcept { __std_tzdb_delete_sys_info(_Info); } }; template <> struct _Tzdb_deleter<__std_tzdb_leap_info[]> { - void operator()(__std_tzdb_leap_info* _Info) const noexcept { + _STATIC_CALL_OPERATOR void operator()(__std_tzdb_leap_info* _Info) _CONST_CALL_OPERATOR noexcept { __std_tzdb_delete_leap_seconds(_Info); } }; diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 47f957d9ed2..5140b264069 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -54,6 +54,8 @@ _Min_max_element_t __stdcall __std_minmax_element_1(const void* _First, const vo _Min_max_element_t __stdcall __std_minmax_element_2(const void* _First, const void* _Last, bool _Signed) noexcept; _Min_max_element_t __stdcall __std_minmax_element_4(const void* _First, const void* _Last, bool _Signed) noexcept; _Min_max_element_t __stdcall __std_minmax_element_8(const void* _First, const void* _Last, bool _Signed) noexcept; +_Min_max_element_t __stdcall __std_minmax_element_f(const void* _First, const void* _Last, bool _Unused) noexcept; +_Min_max_element_t __stdcall __std_minmax_element_d(const void* _First, const void* _Last, bool _Unused) noexcept; const void* __stdcall __std_find_last_trivial_1(const void* _First, const void* _Last, uint8_t _Val) noexcept; const void* __stdcall __std_find_last_trivial_2(const void* _First, const void* _Last, uint16_t _Val) noexcept; @@ -68,7 +70,11 @@ _STD pair<_Ty*, _Ty*> __std_minmax_element(_Ty* _First, _Ty* _Last) noexcept { _Min_max_element_t _Res; - if constexpr (sizeof(_Ty) == 1) { + if constexpr (_STD is_same_v<_STD remove_const_t<_Ty>, float>) { + _Res = ::__std_minmax_element_f(_First, _Last, false); + } else if constexpr (_STD _Is_any_of_v<_STD remove_const_t<_Ty>, double, long double>) { + _Res = ::__std_minmax_element_d(_First, _Last, false); + } else if constexpr (sizeof(_Ty) == 1) { _Res = ::__std_minmax_element_1(_First, _Last, _Signed); } else if constexpr (sizeof(_Ty) == 2) { _Res = ::__std_minmax_element_2(_First, _Last, _Signed); @@ -169,7 +175,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 +281,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 +321,7 @@ _EXPORT_STD template using for_each_result = in_fun_result<_In, _Fun>; @@ -324,7 +330,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirectly_unary_invocable> _Fn> - constexpr for_each_result<_It, _Fn> operator()(_It _First, _Se _Last, _Fn _Func, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr for_each_result<_It, _Fn> operator()( + _It _First, _Se _Last, _Fn _Func, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _For_each_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -336,8 +343,8 @@ namespace ranges { template , _Pj>> _Fn> - constexpr for_each_result, _Fn> operator()( - _Rng&& _Range, _Fn _Func, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr for_each_result, _Fn> operator()( + _Rng&& _Range, _Fn _Func, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _For_each_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), @@ -371,8 +378,8 @@ namespace ranges { class _For_each_n_fn { public: template > _Fn> - constexpr for_each_n_result<_It, _Fn> operator()( - _It _First, iter_difference_t<_It> _Count, _Fn _Func, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr for_each_n_result<_It, _Fn> operator()( + _It _First, iter_difference_t<_It> _Count, _Fn _Func, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if (0 < _Count) { auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count); do { @@ -390,7 +397,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,14 +460,14 @@ _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: template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> - _NODISCARD constexpr iter_difference_t<_It> operator()( - _It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr iter_difference_t<_It> operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _Count_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _Val, _STD _Pass_fn(_Proj)); @@ -468,7 +475,8 @@ namespace ranges { template requires indirect_binary_predicate, _Pj>, const _Ty*> - _NODISCARD constexpr range_difference_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr range_difference_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { return _Count_unchecked(_Ubegin(_Range), _Uend(_Range), _Val, _STD _Pass_fn(_Proj)); } @@ -509,7 +517,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,13 +540,14 @@ _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: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr iter_difference_t<_It> operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr iter_difference_t<_It> operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _Count_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -546,7 +555,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr range_difference_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr range_difference_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { return _Count_if_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } @@ -571,7 +581,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 +674,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> @@ -715,8 +725,8 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _RANGES _Unwrap_iter<_Se1>(_STD move(_First1)); @@ -741,8 +751,8 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { using _Size1 = _Make_unsigned_like_t>; const auto _Count = static_cast<_Size1>(_RANGES size(_Range1)); @@ -761,7 +771,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,15 +867,15 @@ _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: template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pj1 = identity, class _Pj2 = identity, indirect_equivalence_relation, projected<_It2, _Pj2>> _Pr = ranges::equal_to> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _RANGES _Unwrap_iter<_Se1>(_STD move(_First1)); @@ -890,8 +900,8 @@ namespace ranges { template , _Pj1>, projected, _Pj2>> _Pr = ranges::equal_to> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { const auto _Count = _RANGES distance(_Range1); if (_RANGES distance(_Range2) != _Count) { @@ -1128,7 +1138,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,13 +1159,14 @@ _EXPORT_STD template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _All_of_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -1164,7 +1175,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { return _All_of_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } @@ -1187,7 +1199,7 @@ namespace ranges { _EXPORT_STD inline constexpr _All_of_fn all_of; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool any_of(const _InIt _First, const _InIt _Last, _Pr _Pred) { @@ -1209,13 +1221,14 @@ _EXPORT_STD template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _Any_of_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -1224,7 +1237,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { return _Any_of_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } @@ -1247,7 +1261,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Any_of_fn any_of; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool none_of(const _InIt _First, const _InIt _Last, _Pr _Pred) { @@ -1269,13 +1283,14 @@ _EXPORT_STD template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _None_of_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -1284,7 +1299,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { return _None_of_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } @@ -1312,7 +1328,8 @@ namespace ranges { public: template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); const auto _ULast = _RANGES _Unwrap_sent<_It>(_STD move(_Last)); const auto _UResult = _RANGES _Find_unchecked( @@ -1322,7 +1339,8 @@ namespace ranges { template requires indirect_binary_predicate, _Pj>, const _Ty*> - _NODISCARD constexpr bool operator()(_Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _UResult = _RANGES _Find_unchecked(_Ubegin(_Range), _Uend(_Range), _Val, _STD _Pass_fn(_Proj)); return _UResult != _Uend(_Range); } @@ -1335,8 +1353,8 @@ namespace ranges { template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First2, _Last2); auto _UFirst2 = _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)); auto _ULast2 = _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)); @@ -1353,8 +1371,8 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if (_RANGES empty(_Range2)) { return true; } @@ -1375,7 +1393,8 @@ namespace ranges { public: template requires indirectly_copyable<_It, _Out> - constexpr copy_n_result<_It, _Out> operator()(_It _First, iter_difference_t<_It> _Count, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr copy_n_result<_It, _Out> operator()( + _It _First, iter_difference_t<_It> _Count, _Out _Result) _CONST_CALL_OPERATOR { auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count); if constexpr (_Iter_copy_cat::_Bitcopy_assignable) { if (!_STD is_constant_evaluated()) { @@ -1404,7 +1423,8 @@ namespace ranges { public: template _Se1, bidirectional_iterator _It2> requires indirectly_copyable<_It1, _It2> - constexpr copy_backward_result<_It1, _It2> operator()(_It1 _First, _Se1 _Last, _It2 _Result) const { + _STATIC_CALL_OPERATOR constexpr copy_backward_result<_It1, _It2> operator()( + _It1 _First, _Se1 _Last, _It2 _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se1>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It1>(_UFirst, _STD move(_Last)); @@ -1415,7 +1435,8 @@ namespace ranges { template requires indirectly_copyable, _It> - constexpr copy_backward_result, _It> operator()(_Rng&& _Range, _It _Result) const { + _STATIC_CALL_OPERATOR constexpr copy_backward_result, _It> operator()( + _Rng&& _Range, _It _Result) _CONST_CALL_OPERATOR { auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); _Result = _STD _Copy_backward_unchecked(_Ubegin(_Range), _ULast, _STD move(_Result)); return {_RANGES _Rewrap_iterator(_Range, _STD move(_ULast)), _STD move(_Result)}; @@ -1424,7 +1445,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Copy_backward_fn copy_backward; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _OutIt copy_if(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pred) { // copy each satisfying _Pred @@ -1454,7 +1475,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>; @@ -1464,8 +1485,8 @@ namespace ranges { template _Se, weakly_incrementable _Out, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out> - constexpr copy_if_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, _Pr _Pred, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr copy_if_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Copy_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result), _STD _Pass_fn(_Pred), @@ -1477,8 +1498,8 @@ namespace ranges { template , _Pj>> _Pr> requires indirectly_copyable, _Out> - constexpr copy_if_result, _Out> operator()( - _Rng&& _Range, _Out _Result, _Pr _Pred, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr copy_if_result, _Out> operator()( + _Rng&& _Range, _Out _Result, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Copy_if_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -1533,7 +1554,8 @@ namespace ranges { public: template _Se, weakly_incrementable _Out> requires indirectly_movable<_It, _Out> - constexpr move_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr move_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _RANGES _Move_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result)); @@ -1544,7 +1566,8 @@ namespace ranges { template requires indirectly_movable, _Out> - constexpr move_result, _Out> operator()(_Rng&& _Range, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr move_result, _Out> operator()( + _Rng&& _Range, _Out _Result) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _RANGES _Move_unchecked( _RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result)); @@ -1580,7 +1603,8 @@ namespace ranges { public: template _Se1, bidirectional_iterator _It2> requires indirectly_movable<_It1, _It2> - constexpr move_backward_result<_It1, _It2> operator()(_It1 _First, _Se1 _Last, _It2 _Result) const { + _STATIC_CALL_OPERATOR constexpr move_backward_result<_It1, _It2> operator()( + _It1 _First, _Se1 _Last, _It2 _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se1>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It1>(_UFirst, _STD move(_Last)); @@ -1591,7 +1615,8 @@ namespace ranges { template requires indirectly_movable, _It> - constexpr move_backward_result, _It> operator()(_Rng&& _Range, _It _Result) const { + _STATIC_CALL_OPERATOR constexpr move_backward_result, _It> operator()( + _Rng&& _Range, _It _Result) _CONST_CALL_OPERATOR { auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); _Result = _RANGES _Move_backward_common(_Ubegin(_Range), _ULast, _STD move(_Result)); return {_RANGES _Rewrap_iterator(_Range, _STD move(_ULast)), _STD move(_Result)}; @@ -1600,17 +1625,17 @@ 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( _InIt _First, _InIt _Last, _OutIt1 _Dest_true, _OutIt2 _Dest_false, _Pr _Pred) { // copy true partition to _Dest_true, false to _Dest_false - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); - auto _UDest_true = _Get_unwrapped_unverified(_Dest_true); - auto _UDest_false = _Get_unwrapped_unverified(_Dest_false); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); + auto _UDest_true = _STD _Get_unwrapped_unverified(_Dest_true); + auto _UDest_false = _STD _Get_unwrapped_unverified(_Dest_false); for (; _UFirst != _ULast; ++_UFirst) { if (_Pred(*_UFirst)) { *_UDest_true = *_UFirst; @@ -1621,8 +1646,8 @@ _CONSTEXPR20 pair<_OutIt1, _OutIt2> partition_copy( } } - _Seek_wrapped(_Dest_false, _UDest_false); - _Seek_wrapped(_Dest_true, _UDest_true); + _STD _Seek_wrapped(_Dest_false, _UDest_false); + _STD _Seek_wrapped(_Dest_true, _UDest_true); return {_Dest_true, _Dest_false}; } @@ -1636,10 +1661,10 @@ pair<_FwdIt2, _FwdIt3> partition_copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _F _REQUIRE_PARALLEL_ITERATOR(_FwdIt1); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt2); _REQUIRE_CPP17_MUTABLE_ITERATOR(_FwdIt3); - return _STD partition_copy(_First, _Last, _Dest_true, _Dest_false, _Pass_fn(_Pred)); + return _STD partition_copy(_First, _Last, _Dest_true, _Dest_false, _STD _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>; @@ -1649,30 +1674,30 @@ namespace ranges { template _Se, weakly_incrementable _Out1, weakly_incrementable _Out2, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out1> && indirectly_copyable<_It, _Out2> - constexpr partition_copy_result<_It, _Out1, _Out2> operator()( - _It _First, _Se _Last, _Out1 _Dest_true, _Out2 _Dest_false, _Pr _Pred, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UResult = _Partition_copy_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), - _Unwrap_sent<_It>(_STD move(_Last)), _Get_unwrapped_unverified(_STD move(_Dest_true)), - _Get_unwrapped_unverified(_STD move(_Dest_false)), _Pass_fn(_Pred), _Pass_fn(_Proj)); - _Seek_wrapped(_First, _STD move(_UResult.in)); - _Seek_wrapped(_Dest_true, _STD move(_UResult.out1)); - _Seek_wrapped(_Dest_false, _STD move(_UResult.out2)); + _STATIC_CALL_OPERATOR constexpr partition_copy_result<_It, _Out1, _Out2> operator()(_It _First, _Se _Last, + _Out1 _Dest_true, _Out2 _Dest_false, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UResult = _Partition_copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), + _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Get_unwrapped_unverified(_STD move(_Dest_true)), + _STD _Get_unwrapped_unverified(_STD move(_Dest_false)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + _STD _Seek_wrapped(_First, _STD move(_UResult.in)); + _STD _Seek_wrapped(_Dest_true, _STD move(_UResult.out1)); + _STD _Seek_wrapped(_Dest_false, _STD move(_UResult.out2)); return {_STD move(_First), _STD move(_Dest_true), _STD move(_Dest_false)}; } template , _Pj>> _Pr> requires indirectly_copyable, _Out1> && indirectly_copyable, _Out2> - constexpr partition_copy_result, _Out1, _Out2> operator()( - _Rng&& _Range, _Out1 _Dest_true, _Out2 _Dest_false, _Pr _Pred, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr partition_copy_result, _Out1, _Out2> operator()( + _Rng&& _Range, _Out1 _Dest_true, _Out2 _Dest_false, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); - auto _UResult = _Partition_copy_unchecked(_Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), - _Get_unwrapped_unverified(_STD move(_Dest_true)), _Get_unwrapped_unverified(_STD move(_Dest_false)), - _Pass_fn(_Pred), _Pass_fn(_Proj)); - _Seek_wrapped(_First, _STD move(_UResult.in)); - _Seek_wrapped(_Dest_true, _STD move(_UResult.out1)); - _Seek_wrapped(_Dest_false, _STD move(_UResult.out2)); + auto _UResult = _Partition_copy_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), + _Uend(_Range), _STD _Get_unwrapped_unverified(_STD move(_Dest_true)), + _STD _Get_unwrapped_unverified(_STD move(_Dest_false)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + _STD _Seek_wrapped(_First, _STD move(_UResult.in)); + _STD _Seek_wrapped(_Dest_true, _STD move(_UResult.out1)); + _STD _Seek_wrapped(_Dest_false, _STD move(_UResult.out2)); return {_STD move(_First), _STD move(_Dest_true), _STD move(_Dest_false)}; } @@ -1703,15 +1728,15 @@ 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 _NODISCARD _CONSTEXPR20 bool is_partitioned(const _InIt _First, const _InIt _Last, _Pr _Pred) { // test if [_First, _Last) partitioned by _Pred - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); for (;; ++_UFirst) { // skip true partition if (_UFirst == _ULast) { @@ -1737,22 +1762,25 @@ _EXPORT_STD template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - return _Is_partitioned_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), - _Pass_fn(_Pred), _Pass_fn(_Proj)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + return _Is_partitioned_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), + _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } template , _Pj>> _Pr> - _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { - return _Is_partitioned_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + return _Is_partitioned_unchecked( + _Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } private: @@ -1785,21 +1813,21 @@ namespace ranges { _EXPORT_STD inline constexpr _Is_partitioned_fn is_partitioned; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD _CONSTEXPR20 _FwdIt partition_point(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { // find beginning of false partition in [_First, _Last) - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); auto _Count = _STD distance(_UFirst, _ULast); while (0 < _Count) { // divide and conquer, find half that contains answer const auto _Count2 = static_cast<_Iter_diff_t<_FwdIt>>(_Count / 2); const auto _UMid = _STD next(_UFirst, _Count2); if (_Pred(*_UMid)) { // try top half - _UFirst = _Next_iter(_UMid); + _UFirst = _STD _Next_iter(_UMid); _Count -= _Count2; --_Count; } else { @@ -1807,42 +1835,46 @@ _NODISCARD _CONSTEXPR20 _FwdIt partition_point(_FwdIt _First, _FwdIt _Last, _Pr } } - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Partition_point_fn { public: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); if constexpr (sized_sentinel_for<_Se, _It>) { - const auto _Length = _Unwrap_sent<_It>(_STD move(_Last)) - _UFirst; - _UFirst = _Partition_point_n_unchecked(_STD move(_UFirst), _Length, _Pass_fn(_Pred), _Pass_fn(_Proj)); + const auto _Length = _RANGES _Unwrap_sent<_It>(_STD move(_Last)) - _UFirst; + _UFirst = _Partition_point_n_unchecked( + _STD move(_UFirst), _Length, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } else { - _UFirst = _Partition_point_unchecked( - _STD move(_UFirst), _Unwrap_sent<_It>(_STD move(_Last)), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _UFirst = _Partition_point_unchecked(_STD move(_UFirst), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); } - _Seek_wrapped(_First, _STD move(_UFirst)); + _STD _Seek_wrapped(_First, _STD move(_UFirst)); return _First; } template , _Pj>> _Pr> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (sized_range<_Rng>) { const auto _Length = _RANGES distance(_Range); - auto _UFirst = _Partition_point_n_unchecked(_Ubegin(_Range), _Length, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_UFirst)); - } else { auto _UFirst = - _Partition_point_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_UFirst)); + _Partition_point_n_unchecked(_Ubegin(_Range), _Length, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_UFirst)); + } else { + auto _UFirst = _Partition_point_unchecked( + _Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_UFirst)); } } @@ -1905,7 +1937,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,15 +2127,15 @@ _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: template _Se, class _Ty, class _Pr = ranges::equal_to, class _Pj = identity> requires indirectly_comparable<_It, const _Ty*, _Pr, _Pj> - _NODISCARD constexpr subrange<_It> operator()(_It _First, _Se _Last, const iter_difference_t<_It> _Count, - const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()(_It _First, _Se _Last, + const iter_difference_t<_It> _Count, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); if (_Count <= 0) { @@ -2127,8 +2159,9 @@ namespace ranges { template requires indirectly_comparable, const _Ty*, _Pr, _Pj> - _NODISCARD constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, const range_difference_t<_Rng> _Count, - const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, + const range_difference_t<_Rng> _Count, const _Ty& _Val, _Pr _Pred = {}, + _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); if (_Count <= 0) { @@ -2258,8 +2291,8 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); @@ -2288,8 +2321,8 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if constexpr (_Sized_or_infinite_range<_Rng1> && sized_range<_Rng2>) { const range_difference_t<_Rng2> _Count2 = _RANGES distance(_Range2); if constexpr (sized_range<_Rng1>) { @@ -2319,8 +2352,8 @@ namespace ranges { requires (forward_iterator<_It1> || sized_sentinel_for<_Se1, _It1>) && (forward_iterator<_It2> || sized_sentinel_for<_Se2, _It2>) && indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _RANGES _Unwrap_iter<_Se1>(_STD move(_First1)); @@ -2339,8 +2372,8 @@ namespace ranges { class _Pj2 = identity> requires (forward_range<_Rng1> || sized_range<_Rng1>) && (forward_range<_Rng2> || sized_range<_Rng2>) && indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { const auto _Count1 = _Distance_helper(_Range1); const auto _Count2 = _Distance_helper(_Range2); @@ -2569,21 +2602,23 @@ namespace ranges { class _Fold_left_with_iter_fn { public: template _Se, class _Ty, _Indirectly_binary_left_foldable<_Ty, _It> _Fn> - _NODISCARD constexpr auto operator()(_It _First, _Se _Last, _Ty _Init, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _It _First, _Se _Last, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _Fold_left_with_iter_impl<_It>( _STD move(_First), _STD move(_Last), _STD move(_Init), _STD _Pass_fn(_Func)); } template > _Fn> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Ty _Init, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { return _Fold_left_with_iter_impl>( _RANGES begin(_Range), _RANGES end(_Range), _STD move(_Init), _STD _Pass_fn(_Func)); } private: template - _NODISCARD constexpr auto _Fold_left_with_iter_impl(_It&& _First, _Se&& _Last, _Ty&& _Init, _Fn _Func) const { + _NODISCARD static constexpr auto _Fold_left_with_iter_impl(_It&& _First, _Se&& _Last, _Ty&& _Init, _Fn _Func) { _STL_INTERNAL_STATIC_ASSERT(input_iterator<_It>); _STL_INTERNAL_STATIC_ASSERT(sentinel_for<_Se, _It>); _STL_INTERNAL_STATIC_ASSERT(_Indirectly_binary_left_foldable<_Fn, _Ty, _It>); @@ -2613,12 +2648,14 @@ namespace ranges { class _Fold_left_fn { public: template _Se, class _Ty, _Indirectly_binary_left_foldable<_Ty, _It> _Fn> - _NODISCARD constexpr auto operator()(_It _First, _Se _Last, _Ty _Init, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _It _First, _Se _Last, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { return _RANGES fold_left_with_iter(_STD move(_First), _Last, _STD move(_Init), _STD _Pass_fn(_Func)).value; } template > _Fn> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Ty _Init, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { return _RANGES fold_left_with_iter(_STD forward<_Rng>(_Range), _STD move(_Init), _STD _Pass_fn(_Func)) .value; } @@ -2631,21 +2668,22 @@ namespace ranges { template _Se, _Indirectly_binary_left_foldable, _It> _Fn> requires constructible_from, iter_reference_t<_It>> - _NODISCARD constexpr auto operator()(_It _First, _Se _Last, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _It _First, _Se _Last, _Fn _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _Fold_left_first_with_iter_impl<_It>(_STD move(_First), _STD move(_Last), _STD _Pass_fn(_Func)); } template , iterator_t<_Rng>> _Fn> requires constructible_from, range_reference_t<_Rng>> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Fn _Func) _CONST_CALL_OPERATOR { return _Fold_left_first_with_iter_impl>( _RANGES begin(_Range), _RANGES end(_Range), _STD _Pass_fn(_Func)); } private: template - _NODISCARD constexpr auto _Fold_left_first_with_iter_impl(_It&& _First, _Se&& _Last, _Fn _Func) const { + _NODISCARD static constexpr auto _Fold_left_first_with_iter_impl(_It&& _First, _Se&& _Last, _Fn _Func) { _STL_INTERNAL_STATIC_ASSERT(input_iterator<_It>); _STL_INTERNAL_STATIC_ASSERT(sentinel_for<_Se, _It>); _STL_INTERNAL_STATIC_ASSERT(_Indirectly_binary_left_foldable<_Fn, iter_value_t<_It>, _It>); @@ -2679,13 +2717,14 @@ namespace ranges { template _Se, _Indirectly_binary_left_foldable, _It> _Fn> requires constructible_from, iter_reference_t<_It>> - _NODISCARD constexpr auto operator()(_It _First, _Se _Last, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _It _First, _Se _Last, _Fn _Func) _CONST_CALL_OPERATOR { return _RANGES fold_left_first_with_iter(_STD move(_First), _STD move(_Last), _STD _Pass_fn(_Func)).value; } template , iterator_t<_Rng>> _Fn> requires constructible_from, range_reference_t<_Rng>> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Fn _Func) _CONST_CALL_OPERATOR { return _RANGES fold_left_first_with_iter(_STD forward<_Rng>(_Range), _STD _Pass_fn(_Func)).value; } }; @@ -2715,14 +2754,16 @@ namespace ranges { public: template _Se, class _Ty, _Indirectly_binary_right_foldable<_Ty, _It> _Fn> - _NODISCARD constexpr auto operator()(_It _First, _Se _Last, _Ty _Init, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _It _First, _Se _Last, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _RANGES _Fold_right_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Init), _STD _Pass_fn(_Func)); } template > _Fn> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Ty _Init, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Ty _Init, _Fn _Func) _CONST_CALL_OPERATOR { return _RANGES _Fold_right_unchecked( _Ubegin(_Range), _Uend(_Range), _STD move(_Init), _STD _Pass_fn(_Func)); } @@ -2735,7 +2776,8 @@ namespace ranges { template _Se, _Indirectly_binary_right_foldable, _It> _Fn> requires constructible_from, iter_reference_t<_It>> - _NODISCARD constexpr auto operator()(_It _First, _Se _Last, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _It _First, _Se _Last, _Fn _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); return _Fold_right_last_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Func)); @@ -2744,13 +2786,13 @@ namespace ranges { template , iterator_t<_Rng>> _Fn> requires constructible_from, range_reference_t<_Rng>> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Fn _Func) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Fn _Func) _CONST_CALL_OPERATOR { return _Fold_right_last_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Func)); } private: template - _NODISCARD constexpr auto _Fold_right_last_unchecked(_It _First, _Se _Last, _Fn _Func) const { + _NODISCARD static constexpr auto _Fold_right_last_unchecked(_It _First, _Se _Last, _Fn _Func) { _STL_INTERNAL_STATIC_ASSERT(bidirectional_iterator<_It>); _STL_INTERNAL_STATIC_ASSERT(sentinel_for<_Se, _It>); _STL_INTERNAL_STATIC_ASSERT(_Indirectly_binary_right_foldable<_Fn, iter_value_t<_It>, _It>); @@ -2773,7 +2815,8 @@ namespace ranges { public: template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> - _NODISCARD constexpr subrange<_It> operator()(_It _First, _Se _Last, const _Ty& _Value, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, const _Ty& _Value, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); @@ -2792,8 +2835,8 @@ namespace ranges { template requires indirect_binary_predicate, _Pj>, const _Ty*> - _NODISCARD constexpr borrowed_subrange_t<_Rng> operator()( - _Rng&& _Range, const _Ty& _Value, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Value, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (bidirectional_range<_Rng>) { auto _UResult = _Find_last_unchecked( _Ubegin(_Range), _RANGES _Get_final_iterator_unwrapped(_Range), _Value, _STD _Pass_fn(_Proj)); @@ -2873,7 +2916,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr subrange<_It> operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); @@ -2892,7 +2936,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (bidirectional_range<_Rng>) { auto _UResult = _Find_last_if_unchecked(_Ubegin(_Range), _RANGES _Get_final_iterator_unwrapped(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -2951,7 +2996,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 +3098,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: @@ -3161,8 +3206,8 @@ namespace ranges { template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr subrange<_It1> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, - _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr subrange<_It1> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, + _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _RANGES _Unwrap_iter<_Se1>(_First1); @@ -3191,8 +3236,8 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr borrowed_subrange_t<_Rng1> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng1> operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if constexpr (random_access_range<_Rng1> && sized_range<_Rng1> && random_access_range<_Rng2> && sized_range<_Rng2>) { auto _UResult = @@ -3213,7 +3258,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,15 +3301,15 @@ _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: template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr _It1 operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It1 operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); @@ -3280,8 +3325,8 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr borrowed_iterator_t<_Rng1> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng1> operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _UResult = _Find_first_of_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), @@ -3333,8 +3378,8 @@ namespace ranges { public: template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2> requires indirectly_swappable<_It1, _It2> - constexpr swap_ranges_result<_It1, _It2> operator()( - _It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2) const { + _STATIC_CALL_OPERATOR constexpr swap_ranges_result<_It1, _It2> operator()( + _It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); @@ -3349,8 +3394,8 @@ namespace ranges { template requires indirectly_swappable, iterator_t<_Rng2>> - constexpr swap_ranges_result, borrowed_iterator_t<_Rng2>> operator()( - _Rng1&& _Range1, _Rng2&& _Range2) const { + _STATIC_CALL_OPERATOR constexpr swap_ranges_result, borrowed_iterator_t<_Rng2>> + operator()(_Rng1&& _Range1, _Rng2&& _Range2) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); @@ -3416,7 +3461,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 +3536,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>; @@ -3504,8 +3549,8 @@ namespace ranges { template _Se, weakly_incrementable _Out, copy_constructible _Fn, class _Pj = identity> requires indirectly_writable<_Out, indirect_result_t<_Fn&, projected<_It, _Pj>>> - constexpr unary_transform_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, _Fn _Func, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr unary_transform_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result, _Fn _Func, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Transform_unary_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result), _STD _Pass_fn(_Func), @@ -3517,8 +3562,8 @@ namespace ranges { template requires indirectly_writable<_Out, indirect_result_t<_Fn&, projected, _Pj>>> - constexpr unary_transform_result, _Out> operator()( - _Rng&& _Range, _Out _Result, _Fn _Func, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr unary_transform_result, _Out> operator()( + _Rng&& _Range, _Out _Result, _Fn _Func, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Transform_unary_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result), _STD _Pass_fn(_Func), _STD _Pass_fn(_Proj)); @@ -3530,8 +3575,9 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, copy_constructible _Fn, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_writable<_Out, indirect_result_t<_Fn&, projected<_It1, _Pj1>, projected<_It2, _Pj2>>> - constexpr binary_transform_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, - _Se2 _Last2, _Out _Result, _Fn _Func, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr binary_transform_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Out _Result, _Fn _Func, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UResult = _Transform_binary_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -3548,8 +3594,10 @@ namespace ranges { class _Pj1 = identity, class _Pj2 = identity> requires indirectly_writable<_Out, indirect_result_t<_Fn&, projected, _Pj1>, projected, _Pj2>>> - constexpr binary_transform_result, borrowed_iterator_t<_Rng2>, _Out> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Fn _Func, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr binary_transform_result, borrowed_iterator_t<_Rng2>, + _Out> + operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Fn _Func, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); auto _UResult = _Transform_binary_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), @@ -3597,7 +3645,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,15 +3666,15 @@ 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: template _Se, class _Ty1, class _Ty2, class _Pj = identity> requires indirectly_writable<_It, const _Ty2&> && indirect_binary_predicate, const _Ty1*> - constexpr _It operator()( - _It _First, _Se _Last, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Replace_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _Oldval, _Newval, _STD _Pass_fn(_Proj)); @@ -3638,8 +3686,8 @@ namespace ranges { template requires indirectly_writable, const _Ty2&> && indirect_binary_predicate, _Pj>, const _Ty1*> - constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Replace_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Oldval, _Newval, _STD _Pass_fn(_Proj)); @@ -3670,7 +3718,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,14 +3738,15 @@ _EXPORT_STD template _Se, class _Ty, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_writable<_It, const _Ty&> - constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Replace_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _Newval, _STD _Pass_fn(_Proj)); @@ -3709,8 +3758,8 @@ namespace ranges { template , _Pj>> _Pr> requires indirectly_writable, const _Ty&> - constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Replace_if_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD _Pass_fn(_Pred), _Newval, _STD _Pass_fn(_Proj)); @@ -3741,7 +3790,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Replace_if_fn replace_if; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _OutIt replace_copy(_InIt _First, _InIt _Last, _OutIt _Dest, const _Ty& _Oldval, const _Ty& _Newval) { @@ -3774,7 +3823,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>; @@ -3785,8 +3834,8 @@ namespace ranges { class _Pj = identity> requires indirectly_copyable<_It, _Out> && indirect_binary_predicate, const _Ty1*> - constexpr replace_copy_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr replace_copy_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result, + const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Replace_copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result), _Oldval, _Newval, @@ -3799,8 +3848,8 @@ namespace ranges { template _Out, class _Pj = identity> requires indirectly_copyable, _Out> && indirect_binary_predicate, _Pj>, const _Ty1*> - constexpr replace_copy_result, _Out> operator()( - _Rng&& _Range, _Out _Result, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr replace_copy_result, _Out> operator()(_Rng&& _Range, + _Out _Result, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Replace_copy_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result), _Oldval, _Newval, _STD _Pass_fn(_Proj)); @@ -3834,7 +3883,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 +3917,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>; @@ -3878,8 +3927,8 @@ namespace ranges { template _Se, class _Ty, output_iterator _Out, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out> - constexpr replace_copy_if_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr replace_copy_if_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Replace_copy_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result), _STD _Pass_fn(_Pred), _Newval, @@ -3892,8 +3941,8 @@ namespace ranges { template _Out, class _Pj = identity, indirect_unary_predicate, _Pj>> _Pr> requires indirectly_copyable, _Out> - constexpr replace_copy_if_result, _Out> operator()( - _Rng&& _Range, _Out _Result, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr replace_copy_if_result, _Out> operator()( + _Rng&& _Range, _Out _Result, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Replace_copy_if_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result), _STD _Pass_fn(_Pred), _Newval, _STD _Pass_fn(_Proj)); @@ -3930,7 +3979,7 @@ namespace ranges { class _Fill_fn { public: template _It, sentinel_for<_It> _Se> - constexpr _It operator()(_It _First, _Se _Last, const _Ty& _Value) const { + _STATIC_CALL_OPERATOR constexpr _It operator()(_It _First, _Se _Last, const _Ty& _Value) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); const auto _ULast = _RANGES _Unwrap_sent<_It>(_STD move(_Last)); @@ -3961,10 +4010,11 @@ namespace ranges { } template _Rng> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Value) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Value) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); _STD _Seek_wrapped( - _First, (*this)(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Value)); + _First, operator()(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Value)); return _First; } }; @@ -3975,7 +4025,7 @@ namespace ranges { public: template _Se, copy_constructible _Fn> requires invocable<_Fn&> && indirectly_writable<_Out, invoke_result_t<_Fn&>> - constexpr _Out operator()(_Out _First, _Se _Last, _Fn _Gen) const { + _STATIC_CALL_OPERATOR constexpr _Out operator()(_Out _First, _Se _Last, _Fn _Gen) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); _STD _Seek_wrapped(_First, _Generate_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_Out>(_STD move(_Last)), _STD _Pass_fn(_Gen))); @@ -3984,7 +4034,8 @@ namespace ranges { template requires invocable<_Fn&> && output_range<_Rng, invoke_result_t<_Fn&>> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Fn _Gen) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Fn _Gen) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); _STD _Seek_wrapped(_First, _Generate_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD _Pass_fn(_Gen))); @@ -4014,7 +4065,8 @@ namespace ranges { public: template requires invocable<_Fn&> && indirectly_writable<_Out, invoke_result_t<_Fn&>> - constexpr _Out operator()(_Out _First, iter_difference_t<_Out> _Count, _Fn _Gen) const { + _STATIC_CALL_OPERATOR constexpr _Out operator()( + _Out _First, iter_difference_t<_Out> _Count, _Fn _Gen) _CONST_CALL_OPERATOR { if (_Count > 0) { auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count); do { @@ -4031,7 +4083,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,14 +4197,14 @@ _EXPORT_STD template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> - _NODISCARD_REMOVE_ALG constexpr subrange<_It> operator()( - _It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD_REMOVE_ALG _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Remove_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _Val, _STD _Pass_fn(_Proj)); @@ -4163,8 +4215,8 @@ namespace ranges { template requires permutable> && indirect_binary_predicate, _Pj>, const _Ty*> - _NODISCARD_REMOVE_ALG constexpr borrowed_subrange_t<_Rng> operator()( - _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD_REMOVE_ALG _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _Remove_unchecked(_Ubegin(_Range), _Uend(_Range), _Val, _STD _Pass_fn(_Proj)); return _RANGES _Rewrap_subrange>(_Range, _STD move(_UResult)); @@ -4202,8 +4254,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD_REMOVE_ALG constexpr subrange<_It> operator()( - _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD_REMOVE_ALG _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Remove_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -4214,8 +4266,8 @@ namespace ranges { template , _Pj>> _Pr> requires permutable> - _NODISCARD_REMOVE_ALG constexpr borrowed_subrange_t<_Rng> operator()( - _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD_REMOVE_ALG _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _Remove_if_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -4258,8 +4310,8 @@ namespace ranges { template _Se, weakly_incrementable _Out, class _Ty, class _Pj = identity> requires indirectly_copyable<_It, _Out> && indirect_binary_predicate, const _Ty*> - constexpr remove_copy_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, const _Ty& _Val, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr remove_copy_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Remove_copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Get_unwrapped_unverified(_STD move(_Result)), _Val, @@ -4273,8 +4325,8 @@ namespace ranges { template requires indirectly_copyable, _Out> && indirect_binary_predicate, _Pj>, const _Ty*> - constexpr remove_copy_result, _Out> operator()( - _Rng&& _Range, _Out _Result, const _Ty& _Val, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr remove_copy_result, _Out> operator()( + _Rng&& _Range, _Out _Result, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Remove_copy_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD _Get_unwrapped_unverified(_STD move(_Result)), _Val, _STD _Pass_fn(_Proj)); @@ -4316,8 +4368,8 @@ namespace ranges { template _Se, weakly_incrementable _Out, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_copyable<_It, _Out> - constexpr remove_copy_if_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, _Pr _Pred, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr remove_copy_if_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Remove_copy_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Get_unwrapped_unverified(_STD move(_Result)), @@ -4331,8 +4383,8 @@ namespace ranges { template , _Pj>> _Pr> requires indirectly_copyable, _Out> - constexpr remove_copy_if_result, _Out> operator()( - _Rng&& _Range, _Out _Result, _Pr _Pred, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr remove_copy_if_result, _Out> operator()( + _Rng&& _Range, _Out _Result, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Remove_copy_if_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), @@ -4367,7 +4419,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Remove_copy_if_fn remove_copy_if; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NODISCARD_UNIQUE_ALG _CONSTEXPR20 _FwdIt unique(_FwdIt _First, _FwdIt _Last, _Pr _Pred) { @@ -4417,14 +4469,14 @@ _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: template _Se, class _Pj = identity, indirect_equivalence_relation> _Pr = ranges::equal_to> - _NODISCARD_UNIQUE_ALG constexpr subrange<_It> operator()( - _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD_UNIQUE_ALG _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Unique_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -4435,8 +4487,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::equal_to> requires permutable> - _NODISCARD_UNIQUE_ALG constexpr borrowed_subrange_t<_Rng> operator()( - _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD_UNIQUE_ALG _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _Unique_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -4481,10 +4533,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 +4624,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>; @@ -4589,8 +4641,8 @@ namespace ranges { template _Se, weakly_incrementable _Out, class _Pj = identity, indirect_equivalence_relation> _Pr = ranges::equal_to> requires indirectly_copyable<_It, _Out> && _Can_reread_or_store<_It, _Out> - constexpr unique_copy_result<_It, _Out> operator()( - _It _First, _Se _Last, _Out _Result, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr unique_copy_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Unique_copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Get_unwrapped_unverified(_STD move(_Result)), @@ -4604,8 +4656,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::equal_to> requires indirectly_copyable, _Out> && _Can_reread_or_store, _Out> - constexpr unique_copy_result, _Out> operator()( - _Rng&& _Range, _Out _Result, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr unique_copy_result, _Out> operator()( + _Rng&& _Range, _Out _Result, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Unique_copy_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD _Get_unwrapped_unverified(_STD move(_Result)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -4715,7 +4767,7 @@ namespace ranges { public: template _Se> requires permutable<_It> - constexpr _It operator()(_It _First, _Se _Last) const { + _STATIC_CALL_OPERATOR constexpr _It operator()(_It _First, _Se _Last) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -4726,7 +4778,7 @@ namespace ranges { template requires permutable> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) _CONST_CALL_OPERATOR { auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); _RANGES _Reverse_common(_Ubegin(_Range), _ULast); return _RANGES _Rewrap_iterator(_Range, _STD move(_ULast)); @@ -4735,7 +4787,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 +4849,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>; @@ -4806,7 +4858,8 @@ namespace ranges { public: template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> - constexpr reverse_copy_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr reverse_copy_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -4817,7 +4870,8 @@ namespace ranges { template requires indirectly_copyable, _Out> - constexpr reverse_copy_result, _Out> operator()(_Rng&& _Range, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr reverse_copy_result, _Out> operator()( + _Rng&& _Range, _Out _Result) _CONST_CALL_OPERATOR { if constexpr (common_range<_Rng>) { _Result = _Reverse_copy_common(_Ubegin(_Range), _Uend(_Range), _STD move(_Result)); return {_RANGES end(_Range), _STD move(_Result)}; @@ -4875,10 +4929,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) { @@ -4960,7 +5014,7 @@ namespace ranges { class _Rotate_fn { public: template _Se> - constexpr subrange<_It> operator()(_It _First, _It _Mid, _Se _Last) const { + _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()(_It _First, _It _Mid, _Se _Last) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Mid); _STD _Adl_verify_range(_Mid, _Last); auto _UResult = _RANGES _Rotate_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -4971,7 +5025,8 @@ namespace ranges { template requires permutable> - constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, iterator_t<_Rng> _Mid) const { + _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, iterator_t<_Rng> _Mid) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_RANGES begin(_Range), _Mid); _STD _Adl_verify_range(_Mid, _RANGES end(_Range)); auto _UResult = _RANGES _Rotate_unchecked( @@ -4983,7 +5038,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 +5064,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>; @@ -5018,7 +5073,8 @@ namespace ranges { public: template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> - constexpr rotate_copy_result<_It, _Out> operator()(_It _First, _It _Mid, _Se _Last, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr rotate_copy_result<_It, _Out> operator()( + _It _First, _It _Mid, _Se _Last, _Out _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Mid); _STD _Adl_verify_range(_Mid, _Last); auto _UResult = _Rotate_copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -5031,8 +5087,8 @@ namespace ranges { template requires indirectly_copyable, _Out> - constexpr rotate_copy_result, _Out> operator()( - _Rng&& _Range, iterator_t<_Rng> _Mid, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr rotate_copy_result, _Out> operator()( + _Rng&& _Range, iterator_t<_Rng> _Mid, _Out _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_RANGES begin(_Range), _Mid); _STD _Adl_verify_range(_Mid, _RANGES end(_Range)); auto _UResult = _Rotate_copy_unchecked( @@ -5059,7 +5115,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 +5264,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>; @@ -5222,7 +5278,8 @@ namespace ranges { template _Se, weakly_incrementable _Out, class _Urng> requires (forward_iterator<_It> || random_access_iterator<_Out>) && indirectly_copyable<_It, _Out> && uniform_random_bit_generator> - _Out operator()(_It _First, _Se _Last, _Out _Result, iter_difference_t<_It> _Count, _Urng&& _Func) const { + _STATIC_CALL_OPERATOR _Out operator()( + _It _First, _Se _Last, _Out _Result, iter_difference_t<_It> _Count, _Urng&& _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); if (_Count <= 0) { return _Result; @@ -5243,7 +5300,8 @@ namespace ranges { requires (forward_range<_Rng> || random_access_iterator<_Out>) && indirectly_copyable, _Out> && uniform_random_bit_generator> - _Out operator()(_Rng&& _Range, _Out _Result, range_difference_t<_Rng> _Count, _Urng&& _Func) const { + _STATIC_CALL_OPERATOR _Out operator()( + _Rng&& _Range, _Out _Result, range_difference_t<_Rng> _Count, _Urng&& _Func) _CONST_CALL_OPERATOR { if (_Count <= 0) { return _Result; } @@ -5315,7 +5373,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,13 +5405,13 @@ 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: template _Se, class _Urng> requires permutable<_It> && uniform_random_bit_generator> - _It operator()(_It _First, _Se _Last, _Urng&& _Func) const { + _STATIC_CALL_OPERATOR _It operator()(_It _First, _Se _Last, _Urng&& _Func) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); _Rng_from_urng, remove_reference_t<_Urng>> _RngFunc(_Func); @@ -5366,7 +5424,7 @@ namespace ranges { template requires permutable> && uniform_random_bit_generator> - borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Urng&& _Func) const { + _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Urng&& _Func) _CONST_CALL_OPERATOR { _Rng_from_urng, remove_reference_t<_Urng>> _RngFunc(_Func); return _RANGES _Rewrap_iterator(_Range, _Shuffle_unchecked(_Ubegin(_Range), _Uend(_Range), _RngFunc)); @@ -5401,7 +5459,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,12 +5621,13 @@ _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: template _Se> - constexpr subrange<_It> operator()(_It _First, const _Se _Last, iter_difference_t<_It> _Pos_to_shift) const { + _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, const _Se _Last, iter_difference_t<_It> _Pos_to_shift) _CONST_CALL_OPERATOR { _STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/1)"); _STD _Adl_verify_range(_First, _Last); @@ -5587,7 +5646,8 @@ namespace ranges { template requires permutable> - constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, range_difference_t<_Rng> _Pos_to_shift) const { + _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, range_difference_t<_Rng> _Pos_to_shift) _CONST_CALL_OPERATOR { _STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/1)"); if (_Pos_to_shift == 0) { @@ -5632,7 +5692,8 @@ namespace ranges { class _Shift_right_fn { public: template _Se> - constexpr subrange<_It> operator()(_It _First, const _Se _Last, iter_difference_t<_It> _Pos_to_shift) const { + _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, const _Se _Last, iter_difference_t<_It> _Pos_to_shift) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_First); auto _ULast = _RANGES _Unwrap_sent<_It>(_Last); @@ -5646,7 +5707,8 @@ namespace ranges { template requires permutable> - constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, range_difference_t<_Rng> _Pos_to_shift) const { + _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, range_difference_t<_Rng> _Pos_to_shift) _CONST_CALL_OPERATOR { const auto _Size = _Size_helper(_Range); auto _Result = _Shift_right_impl(_Ubegin(_Range), _Uend(_Range), _Pos_to_shift, _Size); auto _First = _RANGES _Rewrap_iterator(_Range, _Result.begin()); @@ -5786,19 +5848,19 @@ 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) { // move elements satisfying _Pred to beginning of sequence - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + auto _ULast = _STD _Get_unwrapped(_Last); if constexpr (_Is_cpp17_bidi_iter_v<_FwdIt>) { for (;;) { // find any out-of-order pair for (;;) { // skip in-place elements at beginning if (_UFirst == _ULast) { - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } @@ -5812,7 +5874,7 @@ _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) { do { // skip in-place elements at end --_ULast; if (_UFirst == _ULast) { - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } } while (!_Pred(*_ULast)); @@ -5823,7 +5885,7 @@ _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) { } else { for (;;) { // skip in-place elements at beginning if (_UFirst == _ULast) { - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } @@ -5842,7 +5904,7 @@ _CONSTEXPR20 _FwdIt partition(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) { } } - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_First, _UFirst); return _First; } @@ -5850,25 +5912,28 @@ _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: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - constexpr subrange<_It> operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UResult = _Partition_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), - _Unwrap_sent<_It>(_STD move(_Last)), _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_subrange>(_First, _STD move(_UResult)); + _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UResult = _Partition_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), + _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_subrange>(_First, _STD move(_UResult)); } template , _Pj>> _Pr> requires permutable> - constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { - auto _UResult = _Partition_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_subrange>(_Range, _STD move(_UResult)); + _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + auto _UResult = + _Partition_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_subrange>(_Range, _STD move(_UResult)); } private: @@ -5928,7 +5993,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Partition_fn partition; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 template @@ -6011,7 +6076,7 @@ pair<_BidIt, _Iter_diff_t<_BidIt>> _Stable_partition_unchecked1(_BidIt _First, _ if (_Pred(*_Left)) { // excluded the false range before _Mid, invariants reestablished, recurse const pair<_BidIt, _Diff> _Low = - _Stable_partition_unchecked1(_First, _Left, _Pred, _Left_true_count, _Temp_ptr, _Capacity); + _STD _Stable_partition_unchecked1(_First, _Left, _Pred, _Left_true_count, _Temp_ptr, _Capacity); _Left = _Low.first; _Left_true_count = _Low.second; break; @@ -6034,7 +6099,7 @@ pair<_BidIt, _Iter_diff_t<_BidIt>> _Stable_partition_unchecked1(_BidIt _First, _ const _Diff _Right_count = _Count - _Mid_offset; const _Diff _Remaining = _Right_count - _Right_true_count; const pair<_BidIt, _Diff> _High = - _Stable_partition_unchecked1(_Right, _Last, _Pred, _Remaining, _Temp_ptr, _Capacity); + _STD _Stable_partition_unchecked1(_Right, _Last, _Pred, _Remaining, _Temp_ptr, _Capacity); _Right = _High.first; _Right_true_count += _High.second; break; @@ -6045,7 +6110,7 @@ pair<_BidIt, _Iter_diff_t<_BidIt>> _Stable_partition_unchecked1(_BidIt _First, _ } // swap the [_Left, _Mid) false range with the [_Mid, _Right) true range - const _BidIt _Partition_point = _Buffered_rotate_unchecked(_Left, _Mid, _Right, + const _BidIt _Partition_point = _STD _Buffered_rotate_unchecked(_Left, _Mid, _Right, static_cast<_Diff>(_Mid_offset - _Left_true_count), _Right_true_count, _Temp_ptr, _Capacity); return pair<_BidIt, _Diff>(_Partition_point, static_cast<_Diff>(_Left_true_count + _Right_true_count)); } @@ -6080,14 +6145,16 @@ _BidIt _Stable_partition_unchecked(_BidIt _First, _BidIt _Last, _Pr _Pred) { const _Diff _Temp_count = _STD distance(_First, _Last); // _Total_count - 1 since we never need to store *_Last const _Diff _Total_count = _Temp_count + static_cast<_Diff>(1); _Optimistic_temporary_buffer<_Iter_value_t<_BidIt>> _Temp_buf{_Temp_count}; - return _Stable_partition_unchecked1(_First, _Last, _Pred, _Total_count, _Temp_buf._Data, _Temp_buf._Capacity).first; + return _STD _Stable_partition_unchecked1(_First, _Last, _Pred, _Total_count, _Temp_buf._Data, _Temp_buf._Capacity) + .first; } _EXPORT_STD template _BidIt stable_partition(_BidIt _First, _BidIt _Last, _Pr _Pred) { // partition preserving order of equivalents - _Adl_verify_range(_First, _Last); - _Seek_wrapped(_First, _Stable_partition_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Pass_fn(_Pred))); + _STD _Adl_verify_range(_First, _Last); + _STD _Seek_wrapped(_First, _STD _Stable_partition_unchecked( + _STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _STD _Pass_fn(_Pred))); return _First; } @@ -6097,11 +6164,11 @@ _BidIt stable_partition(_ExPo&&, _BidIt _First, _BidIt _Last, _Pr _Pred) noexcep // partition preserving order of equivalents // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_CPP17_MUTABLE_BIDIRECTIONAL_ITERATOR(_BidIt); - return _STD stable_partition(_First, _Last, _Pass_fn(_Pred)); + return _STD stable_partition(_First, _Last, _STD _Pass_fn(_Pred)); } #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, @@ -6142,24 +6209,26 @@ namespace ranges { template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> requires permutable<_It> - subrange<_It> operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STATIC_CALL_OPERATOR subrange<_It> operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - auto _UResult = - _Stable_partition_common(_STD move(_UFirst), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_subrange>(_First, _STD move(_UResult)); + auto _UResult = _Stable_partition_common( + _STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_subrange>(_First, _STD move(_UResult)); } template , _Pj>> _Pr> requires permutable> - borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { - auto _ULast = _Get_final_iterator_unwrapped(_Range); - auto _UResult = - _Stable_partition_common(_Ubegin(_Range), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_subrange>(_Range, _STD move(_UResult)); + _STATIC_CALL_OPERATOR borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); + auto _UResult = _Stable_partition_common( + _Ubegin(_Range), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_subrange>(_Range, _STD move(_UResult)); } private: @@ -6296,7 +6365,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 +6402,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> @@ -6359,7 +6428,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -6370,7 +6440,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (common_range<_Rng>) { _Push_heap_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); @@ -6401,7 +6472,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 +6538,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> @@ -6536,7 +6607,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -6548,7 +6620,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (common_range<_Rng>) { _RANGES _Pop_heap_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); @@ -6562,7 +6635,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 +6661,7 @@ _CONSTEXPR20 void make_heap(_RanIt _First, _RanIt _Last) { // make [_First, _Las _STD make_heap(_First, _Last, less<>{}); } -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { template requires sortable<_It, _Pr, _Pj> @@ -6609,7 +6682,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -6621,7 +6695,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (common_range<_Rng>) { _RANGES _Make_heap_common(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); @@ -6635,7 +6710,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 +6777,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( @@ -6732,7 +6807,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); const auto _ULast = _RANGES _Unwrap_sent<_It>(_STD move(_Last)); @@ -6744,7 +6820,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _Size = _RANGES distance(_Range); const auto _UResult = _RANGES _Is_heap_until_unchecked(_Ubegin(_Range), _Size, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -6758,7 +6835,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); const auto _Size = _RANGES distance(_UFirst, _RANGES _Unwrap_sent<_It>(_STD move(_Last))); @@ -6770,7 +6848,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _Size = _RANGES distance(_Range); auto _UResult = _RANGES _Is_heap_until_unchecked(_Ubegin(_Range), _Size, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -6780,7 +6859,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 +6889,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> @@ -6825,7 +6904,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -6837,7 +6917,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if constexpr (common_range<_Rng>) { _RANGES _Sort_heap_common(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); @@ -6878,25 +6959,25 @@ namespace ranges { public: template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr _It operator()( - _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - const auto _Count = _RANGES distance(_UFirst, _Unwrap_sent<_It>(_STD move(_Last))); - _UFirst = - _RANGES _Lower_bound_unchecked(_STD move(_UFirst), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); - _Seek_wrapped(_First, _STD move(_UFirst)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + const auto _Count = _RANGES distance(_UFirst, _RANGES _Unwrap_sent<_It>(_STD move(_Last))); + _UFirst = _RANGES _Lower_bound_unchecked( + _STD move(_UFirst), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + _STD _Seek_wrapped(_First, _STD move(_UFirst)); return _First; } template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _Count = _RANGES distance(_Range); - auto _UResult = - _RANGES _Lower_bound_unchecked(_Ubegin(_Range), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_UResult)); + auto _UResult = _RANGES _Lower_bound_unchecked( + _Ubegin(_Range), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult)); } }; @@ -6929,62 +7010,62 @@ namespace ranges { public: template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr _It operator()( - _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - const auto _Count = _RANGES distance(_UFirst, _Unwrap_sent<_It>(_STD move(_Last))); - _UFirst = - _RANGES _Upper_bound_unchecked(_STD move(_UFirst), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); - _Seek_wrapped(_First, _STD move(_UFirst)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + const auto _Count = _RANGES distance(_UFirst, _RANGES _Unwrap_sent<_It>(_STD move(_Last))); + _UFirst = _RANGES _Upper_bound_unchecked( + _STD move(_UFirst), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + _STD _Seek_wrapped(_First, _STD move(_UFirst)); return _First; } template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _Count = _RANGES distance(_Range); - auto _UResult = - _RANGES _Upper_bound_unchecked(_Ubegin(_Range), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_UResult)); + auto _UResult = _RANGES _Upper_bound_unchecked( + _Ubegin(_Range), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult)); } }; _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) { // find range equivalent to _Val - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); using _Diff = _Iter_diff_t<_FwdIt>; _Diff _Count = _STD distance(_UFirst, _ULast); for (;;) { // divide and conquer, check midpoint if (_Count <= 0) { - _Seek_wrapped(_Last, _UFirst); // empty range - _Seek_wrapped(_First, _UFirst); + _STD _Seek_wrapped(_Last, _UFirst); // empty range + _STD _Seek_wrapped(_First, _UFirst); break; } _Diff _Count2 = _Count / 2; const auto _UMid = _STD next(_UFirst, _Count2); if (_DEBUG_LT_PRED(_Pred, *_UMid, _Val)) { // range begins above _UMid, loop - _UFirst = _Next_iter(_UMid); + _UFirst = _STD _Next_iter(_UMid); _Count -= _Count2 + 1; } else if (_Pred(_Val, *_UMid)) { _Count = _Count2; // range in first half, loop } else { // range straddles _UMid, find each end and return - auto _UFirst2 = _STD lower_bound(_UFirst, _UMid, _Val, _Pass_fn(_Pred)); + auto _UFirst2 = _STD lower_bound(_UFirst, _UMid, _Val, _STD _Pass_fn(_Pred)); _STD advance(_UFirst, _Count); - auto _ULast2 = _STD upper_bound(_Next_iter(_UMid), _UFirst, _Val, _Pass_fn(_Pred)); - _Seek_wrapped(_Last, _ULast2); - _Seek_wrapped(_First, _UFirst2); + auto _ULast2 = _STD upper_bound(_STD _Next_iter(_UMid), _UFirst, _Val, _STD _Pass_fn(_Pred)); + _STD _Seek_wrapped(_Last, _ULast2); + _STD _Seek_wrapped(_First, _UFirst2); break; } } @@ -6998,29 +7079,31 @@ _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: template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr subrange<_It> operator()( - _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - const auto _Count = _RANGES distance(_UFirst, _Unwrap_sent<_It>(_STD move(_Last))); - auto _UResult = _Equal_range_unchecked(_STD move(_UFirst), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_subrange>(_First, _STD move(_UResult)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr subrange<_It> operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + const auto _Count = _RANGES distance(_UFirst, _RANGES _Unwrap_sent<_It>(_STD move(_Last))); + auto _UResult = + _Equal_range_unchecked(_STD move(_UFirst), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_subrange>(_First, _STD move(_UResult)); } template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_subrange_t<_Rng> operator()( - _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _Count = _RANGES distance(_Range); - auto _UResult = _Equal_range_unchecked(_Ubegin(_Range), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); - auto _Result = _RANGES begin(_Range); - return _Rewrap_subrange>(_Result, _STD move(_UResult)); + auto _UResult = + _Equal_range_unchecked(_Ubegin(_Range), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + auto _Result = _RANGES begin(_Range); + return _RANGES _Rewrap_subrange>(_Result, _STD move(_UResult)); } private: @@ -7057,15 +7140,15 @@ 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) { // test if _Val equivalent to some element - _Adl_verify_range(_First, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); - _UFirst = _STD lower_bound(_UFirst, _ULast, _Val, _Pass_fn(_Pred)); + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); + _UFirst = _STD lower_bound(_UFirst, _ULast, _Val, _STD _Pass_fn(_Pred)); return _UFirst != _ULast && !_Pred(_Val, *_UFirst); } @@ -7075,36 +7158,37 @@ _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: template _Se, class _Ty, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr bool operator()( - _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - const auto _ULast = _Unwrap_sent<_It>(_STD move(_Last)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + const auto _ULast = _RANGES _Unwrap_sent<_It>(_STD move(_Last)); const auto _Count = _RANGES distance(_UFirst, _ULast); - _UFirst = - _RANGES _Lower_bound_unchecked(_STD move(_UFirst), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _UFirst = _RANGES _Lower_bound_unchecked( + _STD move(_UFirst), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _UFirst != _ULast && !_STD invoke(_Pred, _Val, _STD invoke(_Proj, *_UFirst)); } template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) const { - const auto _Count = _RANGES distance(_Range); - const auto _UFirst = - _RANGES _Lower_bound_unchecked(_Ubegin(_Range), _Count, _Val, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, const _Ty& _Val, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + const auto _Count = _RANGES distance(_Range); + const auto _UFirst = _RANGES _Lower_bound_unchecked( + _Ubegin(_Range), _Count, _Val, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _UFirst != _Uend(_Range) && !_STD invoke(_Pred, _Val, _STD invoke(_Proj, *_UFirst)); } }; _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 +7281,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>; @@ -7207,8 +7291,9 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> - constexpr merge_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, - _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr merge_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UResult = _Merge_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -7223,8 +7308,9 @@ namespace ranges { template requires mergeable, iterator_t<_Rng2>, _Out, _Pr, _Pj1, _Pj2> - constexpr merge_result, borrowed_iterator_t<_Rng2>, _Out> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr merge_result, borrowed_iterator_t<_Rng2>, _Out> + operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); auto _UResult = _Merge_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), @@ -7272,7 +7358,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 +7627,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>> @@ -7763,7 +7849,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - _It operator()(_It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR _It operator()( + _It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Mid); _STD _Adl_verify_range(_Mid, _Last); @@ -7778,8 +7865,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, iterator_t<_Rng> _Mid, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, iterator_t<_Rng> _Mid, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _Last = _RANGES end(_Range); @@ -7859,7 +7946,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) { @@ -7870,7 +7957,7 @@ _CONSTEXPR20 _BidIt _Insertion_sort_unchecked(const _BidIt _First, const _BidIt _Iter_value_t<_BidIt> _Val(_STD move(*_Mid)); if (_DEBUG_LT_PRED(_Pred, _Val, *_First)) { // found new earliest element, move to front - _Move_backward_unchecked(_First, _Mid, ++_Hole); + _STD _Move_backward_unchecked(_First, _Mid, ++_Hole); *_First = _STD move(_Val); } else { // look for insertion point after first for (_BidIt _Prev = _Hole; _DEBUG_LT_PRED(_Pred, _Val, *--_Prev); _Hole = _Prev) { @@ -7909,12 +7996,12 @@ _CONSTEXPR20 void _Guess_median_unchecked(_RanIt _First, _RanIt _Mid, _RanIt _La if (40 < _Count) { // Tukey's ninther const _Diff _Step = (_Count + 1) >> 3; // +1 can't overflow because range was made inclusive in caller const _Diff _Two_step = _Step << 1; // note: intentionally discards low-order bit - _Med3_unchecked(_First, _First + _Step, _First + _Two_step, _Pred); - _Med3_unchecked(_Mid - _Step, _Mid, _Mid + _Step, _Pred); - _Med3_unchecked(_Last - _Two_step, _Last - _Step, _Last, _Pred); - _Med3_unchecked(_First + _Step, _Mid, _Last - _Step, _Pred); + _STD _Med3_unchecked(_First, _First + _Step, _First + _Two_step, _Pred); + _STD _Med3_unchecked(_Mid - _Step, _Mid, _Mid + _Step, _Pred); + _STD _Med3_unchecked(_Last - _Two_step, _Last - _Step, _Last, _Pred); + _STD _Med3_unchecked(_First + _Step, _Mid, _Last - _Step, _Pred); } else { - _Med3_unchecked(_First, _Mid, _Last, _Pred); + _STD _Med3_unchecked(_First, _Mid, _Last, _Pred); } } @@ -7922,12 +8009,12 @@ template _CONSTEXPR20 pair<_RanIt, _RanIt> _Partition_by_median_guess_unchecked(_RanIt _First, _RanIt _Last, _Pr _Pred) { // partition [_First, _Last) _RanIt _Mid = _First + ((_Last - _First) >> 1); // shift for codegen - _Guess_median_unchecked(_First, _Mid, _Prev_iter(_Last), _Pred); + _STD _Guess_median_unchecked(_First, _Mid, _STD _Prev_iter(_Last), _Pred); _RanIt _Pfirst = _Mid; - _RanIt _Plast = _Next_iter(_Pfirst); + _RanIt _Plast = _STD _Next_iter(_Pfirst); - while (_First < _Pfirst && !_DEBUG_LT_PRED(_Pred, *_Prev_iter(_Pfirst), *_Pfirst) - && !_Pred(*_Pfirst, *_Prev_iter(_Pfirst))) { + while (_First < _Pfirst && !_DEBUG_LT_PRED(_Pred, *_STD _Prev_iter(_Pfirst), *_Pfirst) + && !_Pred(*_Pfirst, *_STD _Prev_iter(_Pfirst))) { --_Pfirst; } @@ -7953,7 +8040,7 @@ _CONSTEXPR20 pair<_RanIt, _RanIt> _Partition_by_median_guess_unchecked(_RanIt _F } for (; _First < _Glast; --_Glast) { - const auto _Glast_prev = _Prev_iter(_Glast); + const auto _Glast_prev = _STD _Prev_iter(_Glast); if (_DEBUG_LT_PRED(_Pred, *_Glast_prev, *_Pfirst)) { continue; } else if (_Pred(*_Pfirst, *_Glast_prev)) { @@ -7994,26 +8081,26 @@ _CONSTEXPR20 void _Sort_unchecked(_RanIt _First, _RanIt _Last, _Iter_diff_t<_Ran // order [_First, _Last) for (;;) { if (_Last - _First <= _ISORT_MAX) { // small - _Insertion_sort_unchecked(_First, _Last, _Pred); + _STD _Insertion_sort_unchecked(_First, _Last, _Pred); return; } if (_Ideal <= 0) { // heap sort if too many divisions - _Make_heap_unchecked(_First, _Last, _Pred); - _Sort_heap_unchecked(_First, _Last, _Pred); + _STD _Make_heap_unchecked(_First, _Last, _Pred); + _STD _Sort_heap_unchecked(_First, _Last, _Pred); return; } // divide and conquer by quicksort - auto _Mid = _Partition_by_median_guess_unchecked(_First, _Last, _Pred); + auto _Mid = _STD _Partition_by_median_guess_unchecked(_First, _Last, _Pred); _Ideal = (_Ideal >> 1) + (_Ideal >> 2); // allow 1.5 log2(N) divisions if (_Mid.first - _First < _Last - _Mid.second) { // loop on second half - _Sort_unchecked(_First, _Mid.first, _Ideal, _Pred); + _STD _Sort_unchecked(_First, _Mid.first, _Ideal, _Pred); _First = _Mid.second; } else { // loop on first half - _Sort_unchecked(_Mid.second, _Last, _Ideal, _Pred); + _STD _Sort_unchecked(_Mid.second, _Last, _Ideal, _Pred); _Last = _Mid.first; } } @@ -8021,10 +8108,10 @@ _CONSTEXPR20 void _Sort_unchecked(_RanIt _First, _RanIt _Last, _Iter_diff_t<_Ran _EXPORT_STD template _CONSTEXPR20 void sort(const _RanIt _First, const _RanIt _Last, _Pr _Pred) { // order [_First, _Last) - _Adl_verify_range(_First, _Last); - const auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); - _Sort_unchecked(_UFirst, _ULast, _ULast - _UFirst, _Pass_fn(_Pred)); + _STD _Adl_verify_range(_First, _Last); + const auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); + _STD _Sort_unchecked(_UFirst, _ULast, _ULast - _UFirst, _STD _Pass_fn(_Pred)); } _EXPORT_STD template @@ -8043,7 +8130,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> @@ -8103,12 +8190,12 @@ namespace ranges { if (_Count > 40) { // Tukey's ninther const _Diff _Step = (_Count + 1) >> 3; // +1 can't overflow because range was made inclusive in caller const _Diff _Two_step = _Step << 1; // note: intentionally discards low-order bit - _Med3_common(_First, _First + _Step, _First + _Two_step, _Pred, _Proj); - _Med3_common(_Mid - _Step, _Mid, _Mid + _Step, _Pred, _Proj); - _Med3_common(_Last - _Two_step, _Last - _Step, _Last, _Pred, _Proj); - _Med3_common(_First + _Step, _Mid, _Last - _Step, _Pred, _Proj); + _RANGES _Med3_common(_First, _First + _Step, _First + _Two_step, _Pred, _Proj); + _RANGES _Med3_common(_Mid - _Step, _Mid, _Mid + _Step, _Pred, _Proj); + _RANGES _Med3_common(_Last - _Two_step, _Last - _Step, _Last, _Pred, _Proj); + _RANGES _Med3_common(_First + _Step, _Mid, _Last - _Step, _Pred, _Proj); } else { - _Med3_common(_First, _Mid, _Last, _Pred, _Proj); + _RANGES _Med3_common(_First, _Mid, _Last, _Pred, _Proj); } } @@ -8119,7 +8206,7 @@ namespace ranges { // elements greater than pivot; return the equal partition as a subrange. _It _Mid = _First + ((_Last - _First) >> 1); // shift for codegen - _Guess_median_common(_First, _Mid, _RANGES prev(_Last), _Pred, _Proj); + _RANGES _Guess_median_common(_First, _Mid, _RANGES prev(_Last), _Pred, _Proj); _It _Pfirst = _Mid; _It _Plast = _RANGES next(_Pfirst); @@ -8192,24 +8279,26 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); const auto _Count = _ULast - _UFirst; - _Sort_common(_STD move(_UFirst), _STD move(_ULast), _Count, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Sort_common(_STD move(_UFirst), _STD move(_ULast), _Count, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UFirst = _Ubegin(_Range); - auto _ULast = _Get_final_iterator_unwrapped(_Range); + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); const auto _Count = _ULast - _UFirst; - _Sort_common(_STD move(_UFirst), _ULast, _Count, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_ULast)); + _Sort_common(_STD move(_UFirst), _ULast, _Count, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_ULast)); } private: @@ -8226,19 +8315,15 @@ namespace ranges { } if (_Ideal <= 0) { // heap sort if too many divisions - _Make_heap_common(_First, _Last, _Pred, _Proj); - _Sort_heap_common(_STD move(_First), _STD move(_Last), _Pred, _Proj); + _RANGES _Make_heap_common(_First, _Last, _Pred, _Proj); + _RANGES _Sort_heap_common(_STD move(_First), _STD move(_Last), _Pred, _Proj); return; } // divide and conquer by quicksort -#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10452846 - auto [_Mid_first, _Mid_last] = _Partition_by_median_guess_common(_First, _Last, _Pred, _Proj); -#else // ^^^ no workaround / workaround vvv - auto _Mid = _Partition_by_median_guess_common(_First, _Last, _Pred, _Proj); + auto _Mid = _RANGES _Partition_by_median_guess_common(_First, _Last, _Pred, _Proj); auto _Mid_first = _Mid.begin(); auto _Mid_last = _Mid.end(); -#endif // TRANSITION, DevCom-10452846 _Ideal = (_Ideal >> 1) + (_Ideal >> 2); // allow 1.5 log2(N) divisions @@ -8255,7 +8340,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) { @@ -8323,7 +8408,7 @@ void _Uninitialized_chunked_merge_unchecked2( const auto _Chunk2 = (_STD min)(_Isort_max<_BidIt>, _Count); _Count -= _Chunk2; const _BidIt _Mid2 = _STD next(_Mid1, _Chunk2); - _Backout._Last = _Uninitialized_merge_move(_First, _Mid1, _Mid2, _Backout._Last, _Pred); + _Backout._Last = _STD _Uninitialized_merge_move(_First, _Mid1, _Mid2, _Backout._Last, _Pred); _First = _Mid2; } @@ -8343,7 +8428,7 @@ void _Chunked_merge_unchecked(_BidIt _First, const _BidIt _Last, _OutIt _Dest, c const auto _Chunk2 = (_STD min)(_Chunk, _Count); _Count -= _Chunk2; const _BidIt _Mid2 = _STD next(_Mid1, _Chunk2); - _Dest = _Merge_move(_First, _Mid1, _Mid2, _Dest, _Pred); + _Dest = _STD _Merge_move(_First, _Mid1, _Mid2, _Dest, _Pred); _First = _Mid2; } @@ -8355,10 +8440,10 @@ void _Insertion_sort_isort_max_chunks(_BidIt _First, const _BidIt _Last, _Iter_d // insertion sort every chunk of distance _Isort_max<_BidIt> in [_First, _Last) // pre: _Count == distance(_First, _Last) for (; _Isort_max<_BidIt> < _Count; _Count -= _Isort_max<_BidIt>) { // sort chunks - _First = _Insertion_sort_unchecked(_First, _STD next(_First, _Isort_max<_BidIt>), _Pred); + _First = _STD _Insertion_sort_unchecked(_First, _STD next(_First, _Isort_max<_BidIt>), _Pred); } - _Insertion_sort_unchecked(_First, _Last, _Pred); // sort partial last chunk + _STD _Insertion_sort_unchecked(_First, _Last, _Pred); // sort partial last chunk } template @@ -8367,20 +8452,20 @@ void _Buffered_merge_sort_unchecked(const _BidIt _First, const _BidIt _Last, con // sort using temp buffer for merges // pre: _Last - _First == _Count // pre: _Count <= capacity of buffer at _Temp_ptr; also allows safe narrowing to ptrdiff_t - _Insertion_sort_isort_max_chunks(_First, _Last, _Count, _Pred); + _STD _Insertion_sort_isort_max_chunks(_First, _Last, _Count, _Pred); // merge adjacent pairs of chunks to and from temp buffer if (_Count <= _Isort_max<_BidIt>) { return; } // do the first merge, constructing elements in the temporary buffer - _Uninitialized_chunked_merge_unchecked2(_First, _Last, _Temp_ptr, _Count, _Pred); + _STD _Uninitialized_chunked_merge_unchecked2(_First, _Last, _Temp_ptr, _Count, _Pred); _Uninitialized_backout<_Iter_value_t<_BidIt>*> _Backout{_Temp_ptr, _Temp_ptr + _Count}; auto _Chunk = _Isort_max<_BidIt>; for (;;) { // unconditionally merge elements back into the source buffer _Chunk <<= 1; - _Chunked_merge_unchecked(_Temp_ptr, _Temp_ptr + _Count, _First, static_cast(_Chunk), + _STD _Chunked_merge_unchecked(_Temp_ptr, _Temp_ptr + _Count, _First, static_cast(_Chunk), static_cast(_Count), _Pred); _Chunk <<= 1; if (_Count <= _Chunk) { // if the input would be a single chunk, it's already sorted and we're done @@ -8388,7 +8473,7 @@ void _Buffered_merge_sort_unchecked(const _BidIt _First, const _BidIt _Last, con } // more merges necessary; merge to temporary buffer - _Chunked_merge_unchecked(_First, _Last, _Temp_ptr, _Chunk, _Count, _Pred); + _STD _Chunked_merge_unchecked(_First, _Last, _Temp_ptr, _Chunk, _Count, _Pred); } } @@ -8398,20 +8483,20 @@ void _Stable_sort_unchecked(const _BidIt _First, const _BidIt _Last, const _Iter // sort preserving order of equivalents using _Diff = _Iter_diff_t<_BidIt>; if (_Count <= _ISORT_MAX) { - _Insertion_sort_unchecked(_First, _Last, _Pred); // small + _STD _Insertion_sort_unchecked(_First, _Last, _Pred); // small } else { // sort halves and merge const auto _Half_count = static_cast<_Diff>(_Count >> 1); // shift for codegen const auto _Half_count_ceil = static_cast<_Diff>(_Count - _Half_count); const _BidIt _Mid = _STD next(_First, _Half_count_ceil); if (_Half_count_ceil <= _Capacity) { // temp buffer big enough, sort each half using buffer - _Buffered_merge_sort_unchecked(_First, _Mid, _Half_count_ceil, _Temp_ptr, _Pred); - _Buffered_merge_sort_unchecked(_Mid, _Last, _Half_count, _Temp_ptr, _Pred); + _STD _Buffered_merge_sort_unchecked(_First, _Mid, _Half_count_ceil, _Temp_ptr, _Pred); + _STD _Buffered_merge_sort_unchecked(_Mid, _Last, _Half_count, _Temp_ptr, _Pred); } else { // temp buffer not big enough, divide and conquer - _Stable_sort_unchecked(_First, _Mid, _Half_count_ceil, _Temp_ptr, _Capacity, _Pred); - _Stable_sort_unchecked(_Mid, _Last, _Half_count, _Temp_ptr, _Capacity, _Pred); + _STD _Stable_sort_unchecked(_First, _Mid, _Half_count_ceil, _Temp_ptr, _Capacity, _Pred); + _STD _Stable_sort_unchecked(_Mid, _Last, _Half_count, _Temp_ptr, _Capacity, _Pred); } - _Buffered_inplace_merge_unchecked( + _STD _Buffered_inplace_merge_unchecked( _First, _Mid, _Last, _Half_count_ceil, _Half_count, _Temp_ptr, _Capacity, _Pred); // merge halves } } @@ -8419,17 +8504,17 @@ void _Stable_sort_unchecked(const _BidIt _First, const _BidIt _Last, const _Iter _EXPORT_STD template void stable_sort(const _BidIt _First, const _BidIt _Last, _Pr _Pred) { // sort preserving order of equivalents - _Adl_verify_range(_First, _Last); - const auto _UFirst = _Get_unwrapped(_First); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Last); + const auto _UFirst = _STD _Get_unwrapped(_First); + const auto _ULast = _STD _Get_unwrapped(_Last); const auto _Count = _STD distance(_UFirst, _ULast); if (_Count <= _ISORT_MAX) { - _Insertion_sort_unchecked(_UFirst, _ULast, _Pass_fn(_Pred)); + _STD _Insertion_sort_unchecked(_UFirst, _ULast, _STD _Pass_fn(_Pred)); return; } _Optimistic_temporary_buffer<_Iter_value_t<_BidIt>> _Temp_buf{_Count - _Count / 2}; - _Stable_sort_unchecked(_UFirst, _ULast, _Count, _Temp_buf._Data, _Temp_buf._Capacity, _Pass_fn(_Pred)); + _STD _Stable_sort_unchecked(_UFirst, _ULast, _Count, _Temp_buf._Data, _Temp_buf._Capacity, _STD _Pass_fn(_Pred)); } #if _HAS_CXX17 @@ -8450,32 +8535,35 @@ 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: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); - _Seek_wrapped(_First, _ULast); + _STATIC_CALL_OPERATOR _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); + _STD _Seek_wrapped(_First, _ULast); const auto _Count = _ULast - _UFirst; - _Stable_sort_common(_STD move(_UFirst), _STD move(_ULast), _Count, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Stable_sort_common( + _STD move(_UFirst), _STD move(_ULast), _Count, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _First; } template requires sortable, _Pr, _Pj> - borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UFirst = _Ubegin(_Range); - auto _ULast = _Get_final_iterator_unwrapped(_Range); + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); const auto _Count = _ULast - _UFirst; - _Stable_sort_common(_STD move(_UFirst), _ULast, _Count, _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_ULast)); + _Stable_sort_common(_STD move(_UFirst), _ULast, _Count, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_ULast)); } private: @@ -8699,30 +8787,30 @@ 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) { // order [_First, _Last) up to _Mid - _Adl_verify_range(_First, _Mid); - _Adl_verify_range(_Mid, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _UMid = _Get_unwrapped(_Mid); - const auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Mid); + _STD _Adl_verify_range(_Mid, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _UMid = _STD _Get_unwrapped(_Mid); + const auto _ULast = _STD _Get_unwrapped(_Last); if (_UFirst == _UMid) { return; // nothing to do, avoid violating _Pop_heap_hole_unchecked preconditions } - _Make_heap_unchecked(_UFirst, _UMid, _Pass_fn(_Pred)); + _STD _Make_heap_unchecked(_UFirst, _UMid, _STD _Pass_fn(_Pred)); for (auto _UNext = _UMid; _UNext < _ULast; ++_UNext) { if (_DEBUG_LT_PRED(_Pred, *_UNext, *_UFirst)) { // replace top with new largest _Iter_value_t<_RanIt> _Val(_STD move(*_UNext)); - _STD _Pop_heap_hole_unchecked(_UFirst, _UMid, _UNext, _STD move(_Val), _Pass_fn(_Pred)); + _STD _Pop_heap_hole_unchecked(_UFirst, _UMid, _UNext, _STD move(_Val), _STD _Pass_fn(_Pred)); } } - _Sort_heap_unchecked(_UFirst, _UMid, _Pass_fn(_Pred)); + _STD _Sort_heap_unchecked(_UFirst, _UMid, _STD _Pass_fn(_Pred)); } _EXPORT_STD template @@ -8737,7 +8825,7 @@ void partial_sort(_ExPo&&, _RanIt _First, _RanIt _Mid, _RanIt _Last, _Pr _Pred) // order [_First, _Last) up to _Mid // parallelism suspected to be infeasible _REQUIRE_CPP17_MUTABLE_RANDOM_ACCESS_ITERATOR(_RanIt); - return _STD partial_sort(_First, _Mid, _Last, _Pass_fn(_Pred)); + return _STD partial_sort(_First, _Mid, _Last, _STD _Pass_fn(_Pred)); } _EXPORT_STD template = 0> @@ -8748,47 +8836,49 @@ 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: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Mid); - _Adl_verify_range(_Mid, _Last); + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Mid); + _STD _Adl_verify_range(_Mid, _Last); if constexpr (is_same_v<_It, _Se>) { - _Partial_sort_common(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_iter<_Se>(_STD move(_Mid)), - _Unwrap_sent<_It>(_Last), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Partial_sort_common(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), + _RANGES _Unwrap_iter<_Se>(_STD move(_Mid)), _RANGES _Unwrap_sent<_It>(_Last), _STD _Pass_fn(_Pred), + _STD _Pass_fn(_Proj)); return _Last; } else { - auto _UMid = _Unwrap_iter<_Se>(_STD move(_Mid)); - auto _ULast = _Get_final_iterator_unwrapped<_It>(_UMid, _STD move(_Last)); - _Seek_wrapped(_Mid, _ULast); - _Partial_sort_common(_Unwrap_iter<_Se>(_STD move(_First)), _STD move(_UMid), _STD move(_ULast), - _Pass_fn(_Pred), _Pass_fn(_Proj)); + auto _UMid = _RANGES _Unwrap_iter<_Se>(_STD move(_Mid)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UMid, _STD move(_Last)); + _STD _Seek_wrapped(_Mid, _ULast); + _Partial_sort_common(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _STD move(_UMid), _STD move(_ULast), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _Mid; } } template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, iterator_t<_Rng> _Mid, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_RANGES begin(_Range), _Mid); - _Adl_verify_range(_Mid, _RANGES end(_Range)); + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, iterator_t<_Rng> _Mid, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_RANGES begin(_Range), _Mid); + _STD _Adl_verify_range(_Mid, _RANGES end(_Range)); if constexpr (common_range<_Rng>) { - _Partial_sort_common(_Ubegin(_Range), _Unwrap_range_iter<_Rng>(_STD move(_Mid)), _Uend(_Range), - _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Partial_sort_common(_Ubegin(_Range), _RANGES _Unwrap_range_iter<_Rng>(_STD move(_Mid)), _Uend(_Range), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES end(_Range); } else { - auto _UMid = _Unwrap_range_iter<_Rng>(_STD move(_Mid)); - auto _ULast = _Get_final_iterator_unwrapped(_Range, _UMid); - _Seek_wrapped(_Mid, _ULast); + auto _UMid = _RANGES _Unwrap_range_iter<_Rng>(_STD move(_Mid)); + auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range, _UMid); + _STD _Seek_wrapped(_Mid, _ULast); _Partial_sort_common( - _Ubegin(_Range), _STD move(_UMid), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Ubegin(_Range), _STD move(_UMid), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _Mid; } } @@ -8803,7 +8893,7 @@ namespace ranges { return; // nothing to do } - _Make_heap_common(_First, _Mid, _Pred, _Proj); + _RANGES _Make_heap_common(_First, _Mid, _Pred, _Proj); for (auto _Next = _Mid; _Next != _Last; ++_Next) { if (_STD invoke(_Pred, _STD invoke(_Proj, *_Next), _STD invoke(_Proj, *_First))) { // replace top with new largest @@ -8812,44 +8902,44 @@ namespace ranges { } } - _Sort_heap_common(_STD move(_First), _STD move(_Mid), _Pred, _Proj); + _RANGES _Sort_heap_common(_STD move(_First), _STD move(_Mid), _Pred, _Proj); } }; _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 _CONSTEXPR20 _RanIt partial_sort_copy(_InIt _First1, _InIt _Last1, _RanIt _First2, _RanIt _Last2, _Pr _Pred) { // copy [_First1, _Last1) into [_First2, _Last2) - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); - auto _UFirst1 = _Get_unwrapped(_First1); - const auto _ULast1 = _Get_unwrapped(_Last1); - auto _UFirst2 = _Get_unwrapped(_First2); - const auto _ULast2 = _Get_unwrapped(_Last2); + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); + auto _UFirst1 = _STD _Get_unwrapped(_First1); + const auto _ULast1 = _STD _Get_unwrapped(_Last1); + auto _UFirst2 = _STD _Get_unwrapped(_First2); + const auto _ULast2 = _STD _Get_unwrapped(_Last2); auto _UMid2 = _UFirst2; if (_UFirst1 != _ULast1 && _UFirst2 != _ULast2) { for (; _UFirst1 != _ULast1 && _UMid2 != _ULast2; ++_UFirst1, (void) ++_UMid2) { *_UMid2 = *_UFirst1; // copy min(_ULast1 - _UFirst1, _ULast2 - _UFirst2) } - _Make_heap_unchecked(_UFirst2, _UMid2, _Pass_fn(_Pred)); + _STD _Make_heap_unchecked(_UFirst2, _UMid2, _STD _Pass_fn(_Pred)); for (; _UFirst1 != _ULast1; ++_UFirst1) { if (_DEBUG_LT_PRED(_Pred, *_UFirst1, *_UFirst2)) { // replace top with new largest: using _Diff = _Iter_diff_t<_RanIt>; - _STD _Pop_heap_hole_by_index( - _UFirst2, static_cast<_Diff>(0), static_cast<_Diff>(_UMid2 - _UFirst2), *_UFirst1, _Pass_fn(_Pred)); + _STD _Pop_heap_hole_by_index(_UFirst2, static_cast<_Diff>(0), static_cast<_Diff>(_UMid2 - _UFirst2), + *_UFirst1, _STD _Pass_fn(_Pred)); } } - _Sort_heap_unchecked(_UFirst2, _UMid2, _Pass_fn(_Pred)); + _STD _Sort_heap_unchecked(_UFirst2, _UMid2, _STD _Pass_fn(_Pred)); } - _Seek_wrapped(_First2, _UMid2); + _STD _Seek_wrapped(_First2, _UMid2); return _First2; } @@ -8867,7 +8957,7 @@ _RanIt partial_sort_copy(_ExPo&&, _FwdIt _First1, _FwdIt _Last1, _RanIt _First2, // parallelism suspected to be infeasible _REQUIRE_PARALLEL_ITERATOR(_FwdIt); _REQUIRE_CPP17_MUTABLE_ITERATOR(_RanIt); - return _STD partial_sort_copy(_First1, _Last1, _First2, _Last2, _Pass_fn(_Pred)); + return _STD partial_sort_copy(_First1, _Last1, _First2, _Last2, _STD _Pass_fn(_Pred)); } _EXPORT_STD template = 0> @@ -8880,7 +8970,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>; @@ -8891,17 +8981,18 @@ namespace ranges { class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_copyable<_It1, _It2> && sortable<_It2, _Pr, _Pj2> && indirect_strict_weak_order<_Pr, projected<_It1, _Pj1>, projected<_It2, _Pj2>> - constexpr partial_sort_copy_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, - _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - _Adl_verify_range(_First1, _Last1); - _Adl_verify_range(_First2, _Last2); + _STATIC_CALL_OPERATOR constexpr partial_sort_copy_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First1, _Last1); + _STD _Adl_verify_range(_First2, _Last2); - auto _UResult = _Partial_sort_copy_unchecked(_Unwrap_iter<_Se1>(_STD move(_First1)), - _Unwrap_sent<_It1>(_STD move(_Last1)), _Unwrap_iter<_Se2>(_STD move(_First2)), - _Unwrap_sent<_It2>(_STD move(_Last2)), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + auto _UResult = _Partial_sort_copy_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), + _RANGES _Unwrap_sent<_It1>(_STD move(_Last1)), _RANGES _Unwrap_iter<_Se2>(_STD move(_First2)), + _RANGES _Unwrap_sent<_It2>(_STD move(_Last2)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), + _STD _Pass_fn(_Proj2)); - _Seek_wrapped(_First1, _STD move(_UResult.in)); - _Seek_wrapped(_First2, _STD move(_UResult.out)); + _STD _Seek_wrapped(_First1, _STD move(_UResult.in)); + _STD _Seek_wrapped(_First2, _STD move(_UResult.out)); return {_STD move(_First1), _STD move(_First2)}; } @@ -8910,14 +9001,16 @@ namespace ranges { requires indirectly_copyable, iterator_t<_Rng2>> && sortable, _Pr, _Pj2> && indirect_strict_weak_order<_Pr, projected, _Pj1>, projected, _Pj2>> - constexpr partial_sort_copy_result, borrowed_iterator_t<_Rng2>> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr partial_sort_copy_result, borrowed_iterator_t<_Rng2>> + operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range1); - auto _UResult = _Partial_sort_copy_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First)), _Uend(_Range1), - _Ubegin(_Range2), _Uend(_Range2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + auto _UResult = _Partial_sort_copy_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First)), + _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), + _STD _Pass_fn(_Proj2)); - _Seek_wrapped(_First, _STD move(_UResult.in)); - return {_STD move(_First), _Rewrap_iterator(_Range2, _STD move(_UResult.out))}; + _STD _Seek_wrapped(_First, _STD move(_UResult.in)); + return {_STD move(_First), _RANGES _Rewrap_iterator(_Range2, _STD move(_UResult.out))}; } private: @@ -8945,7 +9038,7 @@ namespace ranges { ++_Mid2; } while (_First1 != _Last1 && _Mid2 != _Last2); - _Make_heap_common(_First2, _Mid2, _Pred, _Proj2); // Make a heap + _RANGES _Make_heap_common(_First2, _Mid2, _Pred, _Proj2); // Make a heap for (; _First1 != _Last1; ++_First1) { // Scan the remaining elements... // ... for values less than the largest in the heap ... if (_STD invoke(_Pred, _STD invoke(_Proj1, *_First1), _STD invoke(_Proj2, *_First2))) { @@ -8957,30 +9050,30 @@ namespace ranges { } // the heap contains the N smallest elements; sort them - _Sort_heap_common(_STD move(_First2), _Mid2, _Pred, _Proj2); + _RANGES _Sort_heap_common(_STD move(_First2), _Mid2, _Pred, _Proj2); return {_STD move(_First1), _STD move(_Mid2)}; } }; _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 _CONSTEXPR20 void nth_element(_RanIt _First, _RanIt _Nth, _RanIt _Last, _Pr _Pred) { // order Nth element - _Adl_verify_range(_First, _Nth); - _Adl_verify_range(_Nth, _Last); - auto _UFirst = _Get_unwrapped(_First); - const auto _UNth = _Get_unwrapped(_Nth); - auto _ULast = _Get_unwrapped(_Last); + _STD _Adl_verify_range(_First, _Nth); + _STD _Adl_verify_range(_Nth, _Last); + auto _UFirst = _STD _Get_unwrapped(_First); + const auto _UNth = _STD _Get_unwrapped(_Nth); + auto _ULast = _STD _Get_unwrapped(_Last); if (_UNth == _ULast) { return; // nothing to do } while (_ISORT_MAX < _ULast - _UFirst) { // divide and conquer, ordering partition containing Nth - auto _UMid = _Partition_by_median_guess_unchecked(_UFirst, _ULast, _Pass_fn(_Pred)); + auto _UMid = _STD _Partition_by_median_guess_unchecked(_UFirst, _ULast, _STD _Pass_fn(_Pred)); if (_UMid.second <= _UNth) { _UFirst = _UMid.second; @@ -8991,7 +9084,7 @@ _CONSTEXPR20 void nth_element(_RanIt _First, _RanIt _Nth, _RanIt _Last, _Pr _Pre } } - _Insertion_sort_unchecked(_UFirst, _ULast, _Pass_fn(_Pred)); // sort any remainder + _STD _Insertion_sort_unchecked(_UFirst, _ULast, _STD _Pass_fn(_Pred)); // sort any remainder } _EXPORT_STD template @@ -9005,7 +9098,7 @@ void nth_element(_ExPo&&, _RanIt _First, _RanIt _Nth, _RanIt _Last, _Pr _Pred) n // order Nth element // not parallelized at present, parallelism expected to be feasible in a future release _REQUIRE_CPP17_MUTABLE_RANDOM_ACCESS_ITERATOR(_RanIt); - _STD nth_element(_First, _Nth, _Last, _Pass_fn(_Pred)); + _STD nth_element(_First, _Nth, _Last, _STD _Pass_fn(_Pred)); } _EXPORT_STD template = 0> @@ -9016,31 +9109,32 @@ 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: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr _It operator()(_It _First, _It _Nth, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Nth); - _Adl_verify_range(_Nth, _Last); - auto _UNth = _Unwrap_iter<_Se>(_Nth); - auto _UFinal = _Get_final_iterator_unwrapped<_It>(_UNth, _STD move(_Last)); - _Seek_wrapped(_Nth, _UFinal); - - _Nth_element_common(_Unwrap_iter<_Se>(_STD move(_First)), _STD move(_UNth), _STD move(_UFinal), - _Pass_fn(_Pred), _Pass_fn(_Proj)); + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _It _Nth, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Nth); + _STD _Adl_verify_range(_Nth, _Last); + auto _UNth = _RANGES _Unwrap_iter<_Se>(_Nth); + auto _UFinal = _RANGES _Get_final_iterator_unwrapped<_It>(_UNth, _STD move(_Last)); + _STD _Seek_wrapped(_Nth, _UFinal); + + _Nth_element_common(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _STD move(_UNth), _STD move(_UFinal), + _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _Nth; } template requires sortable, _Pr, _Pj> - constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, iterator_t<_Rng> _Nth, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_RANGES begin(_Range), _Nth); - _Adl_verify_range(_Nth, _RANGES end(_Range)); - auto _UNth = _Unwrap_range_iter<_Rng>(_Nth); + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, iterator_t<_Rng> _Nth, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_RANGES begin(_Range), _Nth); + _STD _Adl_verify_range(_Nth, _RANGES end(_Range)); + auto _UNth = _RANGES _Unwrap_range_iter<_Rng>(_Nth); auto _UFinal = [&] { if constexpr (common_range<_Rng>) { return _Uend(_Range); @@ -9050,10 +9144,10 @@ namespace ranges { return _RANGES next(_UNth, _Uend(_Range)); } }(); - _Seek_wrapped(_Nth, _UFinal); + _STD _Seek_wrapped(_Nth, _UFinal); _Nth_element_common( - _Ubegin(_Range), _STD move(_UNth), _STD move(_UFinal), _Pass_fn(_Pred), _Pass_fn(_Proj)); + _Ubegin(_Range), _STD move(_UNth), _STD move(_UFinal), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _Nth; } @@ -9068,7 +9162,7 @@ namespace ranges { } while (_ISORT_MAX < _Last - _First) { // divide and conquer, ordering partition containing Nth - subrange<_It> _Mid = _Partition_by_median_guess_common(_First, _Last, _Pred, _Proj); + subrange<_It> _Mid = _RANGES _Partition_by_median_guess_common(_First, _Last, _Pred, _Proj); if (_Mid.end() <= _Nth) { _First = _Mid.end(); @@ -9086,7 +9180,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,15 +9234,15 @@ _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: template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pj1 = identity, class _Pj2 = identity, indirect_strict_weak_order, projected<_It2, _Pj2>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); return _Includes_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -9160,8 +9254,8 @@ namespace ranges { template , _Pj1>, projected, _Pj2>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { return _Includes_unchecked(_Ubegin(_Range1), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); } @@ -9209,7 +9303,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 +9368,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>; @@ -9284,8 +9378,9 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> - constexpr set_union_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, - _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_union_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UResult = _Set_union_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -9301,8 +9396,9 @@ namespace ranges { template requires mergeable, iterator_t<_Rng2>, _Out, _Pr, _Pj1, _Pj2> - constexpr set_union_result, borrowed_iterator_t<_Rng2>, _Out> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_union_result, borrowed_iterator_t<_Rng2>, _Out> + operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); auto _UResult = _Set_union_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), @@ -9347,7 +9443,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 +9496,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>; @@ -9410,8 +9506,9 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> - constexpr set_intersection_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, - _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_intersection_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UResult = _Set_intersection_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -9427,8 +9524,10 @@ namespace ranges { template requires mergeable, iterator_t<_Rng2>, _Out, _Pr, _Pj1, _Pj2> - constexpr set_intersection_result, borrowed_iterator_t<_Rng2>, _Out> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_intersection_result, borrowed_iterator_t<_Rng2>, + _Out> + operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); auto _UResult = _Set_intersection_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), @@ -9479,7 +9578,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 +9632,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>; @@ -9543,8 +9642,9 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> - constexpr set_difference_result<_It1, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, - _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_difference_result<_It1, _Out> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UResult = _Set_difference_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -9559,8 +9659,9 @@ namespace ranges { template requires mergeable, iterator_t<_Rng2>, _Out, _Pr, _Pj1, _Pj2> - constexpr set_difference_result, _Out> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_difference_result, _Out> operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _UResult = _Set_difference_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _STD _Get_unwrapped_unverified(_STD move(_Result)), @@ -9607,7 +9708,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 +9776,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>; @@ -9685,8 +9786,9 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, weakly_incrementable _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> requires mergeable<_It1, _It2, _Out, _Pr, _Pj1, _Pj2> - constexpr set_symmetric_difference_result<_It1, _It2, _Out> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, - _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _STATIC_CALL_OPERATOR constexpr set_symmetric_difference_result<_It1, _It2, _Out> operator()(_It1 _First1, + _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UResult = _Set_symmetric_difference_unchecked(_RANGES _Unwrap_iter<_Se1>(_STD move(_First1)), @@ -9702,9 +9804,10 @@ namespace ranges { template requires mergeable, iterator_t<_Rng2>, _Out, _Pr, _Pj1, _Pj2> - constexpr set_symmetric_difference_result, borrowed_iterator_t<_Rng2>, _Out> + _STATIC_CALL_OPERATOR constexpr set_symmetric_difference_result, + borrowed_iterator_t<_Rng2>, _Out> operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Out _Result, _Pr _Pred = {}, _Pj1 _Proj1 = {}, - _Pj2 _Proj2 = {}) const { + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _First2 = _RANGES begin(_Range2); auto _UResult = _Set_symmetric_difference_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)), @@ -9758,7 +9861,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 +9953,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>; @@ -9859,8 +9962,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr minmax_element_result<_It> operator()( - _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr minmax_element_result<_It> operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Minmax_element_fwd_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -9872,8 +9975,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr minmax_element_result> operator()( - _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr minmax_element_result> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _Minmax_element_fwd_unchecked( _RANGES _Ubegin(_Range), _RANGES _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return {_RANGES _Rewrap_iterator(_Range, _STD move(_UResult.min)), @@ -9949,7 +10052,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 +10093,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>; @@ -9999,8 +10102,9 @@ namespace ranges { public: template > _Pr = ranges::less> - _NODISCARD constexpr minmax_result operator()(const _Ty& _Left _MSVC_LIFETIMEBOUND, - const _Ty& _Right _MSVC_LIFETIMEBOUND, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr minmax_result operator()( + const _Ty& _Left _MSVC_LIFETIMEBOUND, const _Ty& _Right _MSVC_LIFETIMEBOUND, _Pr _Pred = {}, + _Pj _Proj = {}) _CONST_CALL_OPERATOR { if (_STD invoke(_Pred, _STD invoke(_Proj, _Right), _STD invoke(_Proj, _Left))) { return {_Right, _Left}; } else { @@ -10010,8 +10114,8 @@ namespace ranges { template > _Pr = ranges::less> - _NODISCARD constexpr minmax_result<_Ty> operator()( - initializer_list<_Ty> _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr minmax_result<_Ty> operator()( + initializer_list<_Ty> _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _First = _Range.begin(); const auto _Last = _Range.end(); _STL_ASSERT(_First != _Last, @@ -10022,8 +10126,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> requires indirectly_copyable_storable, range_value_t<_Rng>*> - _NODISCARD constexpr minmax_result> operator()( - _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr minmax_result> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UFirst = _RANGES _Ubegin(_Range); auto _ULast = _RANGES _Uend(_Range); _STL_ASSERT( @@ -10150,7 +10254,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 +10293,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>; @@ -10198,7 +10302,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr next_permutation_result<_It> operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr next_permutation_result<_It> operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -10210,8 +10315,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - constexpr next_permutation_result> operator()( - _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr next_permutation_result> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); const bool _Found = _Next_permutation_common(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -10253,7 +10358,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 +10397,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>; @@ -10301,7 +10406,8 @@ namespace ranges { public: template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> - constexpr prev_permutation_result<_It> operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr prev_permutation_result<_It> operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UFirst = _RANGES _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _RANGES _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -10313,8 +10419,8 @@ namespace ranges { template requires sortable, _Pr, _Pj> - constexpr prev_permutation_result> operator()( - _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _STATIC_CALL_OPERATOR constexpr prev_permutation_result> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _ULast = _RANGES _Get_final_iterator_unwrapped(_Range); const bool _Found = _Prev_permutation_common(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -10356,7 +10462,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,26 +10525,28 @@ _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: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - const auto _ULast = _Unwrap_sent<_It>(_STD move(_Last)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + const auto _ULast = _RANGES _Unwrap_sent<_It>(_STD move(_Last)); const auto _UFirst = _RANGES _Is_sorted_until_unchecked( - _Unwrap_iter<_Se>(_STD move(_First)), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Unwrap_iter<_Se>(_STD move(_First)), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _UFirst == _ULast; } template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _ULast = _Uend(_Range); const auto _UFirst = - _RANGES _Is_sorted_until_unchecked(_Ubegin(_Range), _ULast, _Pass_fn(_Pred), _Pass_fn(_Proj)); + _RANGES _Is_sorted_until_unchecked(_Ubegin(_Range), _ULast, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _UFirst == _ULast; } }; @@ -10449,26 +10557,28 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - _Adl_verify_range(_First, _Last); - auto _UFirst = _RANGES _Is_sorted_until_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), - _Unwrap_sent<_It>(_STD move(_Last)), _Pass_fn(_Pred), _Pass_fn(_Proj)); - _Seek_wrapped(_First, _STD move(_UFirst)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + _STD _Adl_verify_range(_First, _Last); + auto _UFirst = _RANGES _Is_sorted_until_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), + _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + _STD _Seek_wrapped(_First, _STD move(_UFirst)); return _First; } template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - auto _UResult = - _RANGES _Is_sorted_until_unchecked(_Ubegin(_Range), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); - return _Rewrap_iterator(_Range, _STD move(_UResult)); + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { + auto _UResult = _RANGES _Is_sorted_until_unchecked( + _Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); + return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult)); } }; _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,14 +10613,14 @@ _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: template > _Pr = ranges::less> - _NODISCARD constexpr const _Ty& operator()( - const _Ty& _Val, const _Ty& _Lo, const _Ty& _Hi, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr const _Ty& operator()( + const _Ty& _Val, const _Ty& _Lo, const _Ty& _Hi, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STL_ASSERT(!_STD invoke(_Pred, _STD invoke(_Proj, _Hi), _STD invoke(_Proj, _Lo)), "The lower bound cannot be greater than the upper bound in a call to std::ranges::clamp " "(N4950 [alg.clamp]/2)."); @@ -10536,8 +10646,8 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pj1 = identity, class _Pj2 = identity, indirect_strict_weak_order, projected<_It2, _Pj2>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, - _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, + _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); @@ -10550,8 +10660,8 @@ namespace ranges { template , _Pj1>, projected, _Pj2>> _Pr = ranges::less> - _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { return _Lexicographical_compare_unchecked(_Ubegin(_Range1), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj1), _STD _Pass_fn(_Proj2)); } @@ -10608,7 +10718,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 cdc0267dc79..6c9ee17926f 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/bitset b/stl/inc/bitset index 627bf330601..e6e012bc92d 100644 --- a/stl/inc/bitset +++ b/stl/inc/bitset @@ -602,7 +602,7 @@ struct hash> { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bitset<_Bits>; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const bitset<_Bits>& _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const bitset<_Bits>& _Keyval) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Keyval._Array); } }; diff --git a/stl/inc/chrono b/stl/inc/chrono index 982be0a92d1..fc3abc16c08 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; } @@ -2785,7 +2756,7 @@ namespace chrono { _EXPORT_STD template using file_time = time_point; } // namespace chrono -#endif // ^^^ _HAS_CXX20 +#endif // ^^^ _HAS_CXX20 ^^^ #if _HAS_CXX17 namespace filesystem { @@ -2839,10 +2810,10 @@ namespace filesystem { return _File_time; } -#endif // ^^^ _HAS_CXX20 +#endif // ^^^ _HAS_CXX20 ^^^ }; } // namespace filesystem -#endif // ^^^ _HAS_CXX17 +#endif // ^^^ _HAS_CXX17 ^^^ #if _HAS_CXX20 namespace chrono { @@ -4693,8 +4664,7 @@ namespace chrono { } } // namespace chrono -#ifdef __cpp_lib_concepts - // [time.format] +// [time.format] // clang-format off template @@ -5468,7 +5438,7 @@ namespace chrono { continue; } } -#endif // defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET == 65001 +#endif // ^^^ no workaround ^^^ _CharT _Fmt_str[4]; _Stream << _STD put_time<_CharT>(&_Time, _Fmt_string(_Spec, _Fmt_str)); @@ -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 e35d1a3a4d0..751ce2e3984 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>; @@ -346,7 +341,8 @@ _EXPORT_STD struct compare_three_way { struct _Synth_three_way { template - _NODISCARD constexpr auto operator()(const _Ty1& _Left, const _Ty2& _Right) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + const _Ty1& _Left, const _Ty2& _Right) _CONST_CALL_OPERATOR requires requires { { _Left < _Right } -> _Boolean_testable; { _Right < _Left } -> _Boolean_testable; @@ -414,8 +410,8 @@ namespace _Strong_order { public: template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) - _NODISCARD constexpr strong_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr strong_ordering operator()( + _Ty1&& _Left, _Ty2&& _Right) _CONST_CALL_OPERATOR noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast(strong_order(_Left, _Right)); // intentional ADL @@ -521,8 +517,8 @@ namespace _Weak_order { public: template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) - _NODISCARD constexpr weak_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr weak_ordering operator()( + _Ty1&& _Left, _Ty2&& _Right) _CONST_CALL_OPERATOR noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast(weak_order(_Left, _Right)); // intentional ADL @@ -652,8 +648,8 @@ namespace _Partial_order { public: template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) - _NODISCARD constexpr partial_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr partial_ordering operator()( + _Ty1&& _Left, _Ty2&& _Right) _CONST_CALL_OPERATOR noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast(/* ADL */ partial_order(_Left, _Right)); @@ -714,8 +710,8 @@ namespace _Compare_strong_order_fallback { public: template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) - _NODISCARD constexpr strong_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr strong_ordering operator()( + _Ty1&& _Left, _Ty2&& _Right) _CONST_CALL_OPERATOR noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Strong) { return _STD strong_order(_Left, _Right); @@ -764,8 +760,8 @@ namespace _Compare_weak_order_fallback { public: template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) - _NODISCARD constexpr weak_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr weak_ordering operator()( + _Ty1&& _Left, _Ty2&& _Right) _CONST_CALL_OPERATOR noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Weak) { return _STD weak_order(_Left, _Right); @@ -822,8 +818,8 @@ namespace _Compare_partial_order_fallback { public: template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) - _NODISCARD constexpr partial_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr partial_ordering operator()( + _Ty1&& _Left, _Ty2&& _Right) _CONST_CALL_OPERATOR noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Partial) { return _STD partial_order(_Left, _Right); @@ -842,8 +838,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 c377e117b19..4cfc8f5dbfc 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 @@ -122,14 +122,14 @@ namespace ranges { struct _Cpo { template requires _Use_ADL_swap<_Ty1, _Ty2> - constexpr void operator()(_Ty1&& __t, _Ty2&& __u) const + _STATIC_CALL_OPERATOR constexpr void operator()(_Ty1&& __t, _Ty2&& __u) _CONST_CALL_OPERATOR noexcept(noexcept(swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u)))) { // intentional ADL swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u)); // intentional ADL } template requires (!_Use_ADL_swap<_Ty&, _Ty&> && move_constructible<_Ty> && assignable_from<_Ty&, _Ty>) - constexpr void operator()(_Ty& __x, _Ty& __y) const + _STATIC_CALL_OPERATOR constexpr void operator()(_Ty& __x, _Ty& __y) _CONST_CALL_OPERATOR noexcept(is_nothrow_move_constructible_v<_Ty> && is_nothrow_move_assignable_v<_Ty>) { _Ty __tmp(static_cast<_Ty&&>(__x)); __x = static_cast<_Ty&&>(__y); @@ -137,11 +137,11 @@ namespace ranges { } template - constexpr void operator()(_Ty1 (&__t)[_Size], _Ty2 (&__u)[_Size]) const - noexcept(noexcept((*this)(__t[0], __u[0]))) - requires requires { (*this)(__t[0], __u[0]); } { + _STATIC_CALL_OPERATOR constexpr void operator()(_Ty1 (&__t)[_Size], _Ty2 (&__u)[_Size]) _CONST_CALL_OPERATOR + noexcept(noexcept(operator()(__t[0], __u[0]))) + requires requires(_Cpo __fn) { __fn(__t[0], __u[0]); } { for (size_t __i = 0; __i < _Size; ++__i) { - (*this)(__t[__i], __u[__i]); + operator()(__t[__i], __u[__i]); } } }; @@ -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 17c04ae1039..c41e6b36f59 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 { @@ -190,7 +186,8 @@ _NODISCARD constexpr bool operator>=(const coroutine_handle<> _Left, const corou template struct hash> { - _NODISCARD size_t operator()(const coroutine_handle<_Promise>& _Coro) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()( + const coroutine_handle<_Promise>& _Coro) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Coro.address()); } }; diff --git a/stl/inc/deque b/stl/inc/deque index ba0794eb243..766f4a0ad06 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/execution b/stl/inc/execution index 6daa8a156ad..5f26f95a7e9 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -995,7 +995,7 @@ struct _Static_partition_range_backward<_BidIt, _Diff, false> { const auto _Diff_chunks = static_cast<_Diff>(_Chunks); for (_Diff _Idx = _Unchunked_items; _Idx < _Diff_chunks; ++_Idx) { _STD advance(_Last, _Neg_chunk_size); - *++_Result = _Get_unwrapped(_Last); + *++_Result = _STD _Get_unwrapped(_Last); } } @@ -2644,13 +2644,13 @@ bool _Process_sort_work_item(const _RanIt _Basis, _Pr _Pred, _Sort_work_item<_Ra const auto _Last = _First + _Size; const auto _Ideal = _Wi._Ideal; if (_Size <= _Isort_max<_RanIt>) { - _Insertion_sort_unchecked(_First, _Last, _Pred); + _STD _Insertion_sort_unchecked(_First, _Last, _Pred); _Work_complete += _Size; return false; } if (0 < _Ideal) { // divide and conquer by partitioning (quicksort) - const auto _Mid = _Partition_by_median_guess_unchecked(_First, _Last, _Pred); + const auto _Mid = _STD _Partition_by_median_guess_unchecked(_First, _Last, _Pred); const auto _New_ideal = static_cast<_Iter_diff_t<_RanIt>>(_Ideal / 2 + _Ideal / 4); // allow 1.5 log2(N) divisions _Wi._Size = _Mid.first - _First; @@ -2661,8 +2661,8 @@ bool _Process_sort_work_item(const _RanIt _Basis, _Pr _Pred, _Sort_work_item<_Ra } // too many divisions; heap sort - _Make_heap_unchecked(_First, _Last, _Pred); - _Sort_heap_unchecked(_First, _Last, _Pred); + _STD _Make_heap_unchecked(_First, _Last, _Pred); + _STD _Sort_heap_unchecked(_First, _Last, _Pred); _Work_complete += _Size; return false; } @@ -2672,13 +2672,13 @@ void _Process_sort_queue(const _RanIt _Basis, _Pr _Pred, _Work_stealing_membersh _Sort_work_item<_RanIt>& _Wi) noexcept /* terminates */ { _Sort_work_item<_RanIt> _Right_fork_wi; do { // process work items in the local queue - while (_Process_sort_work_item(_Basis, _Pred, _Wi, _Right_fork_wi, _My_ticket._Work_complete)) { + while (_STD _Process_sort_work_item(_Basis, _Pred, _Wi, _Right_fork_wi, _My_ticket._Work_complete)) { _TRY_BEGIN _My_ticket._Push_bottom(_Right_fork_wi); _CATCH(const _Parallelism_resources_exhausted&) // local queue is full and memory can't be acquired, process _Right_fork_wi serially const auto _First = _Basis + _Right_fork_wi._Offset; - _Sort_unchecked(_First, _First + _Right_fork_wi._Size, _Right_fork_wi._Ideal, _Pred); + _STD _Sort_unchecked(_First, _First + _Right_fork_wi._Size, _Right_fork_wi._Ideal, _Pred); _My_ticket._Work_complete += _Right_fork_wi._Size; _CATCH_END } @@ -2705,7 +2705,7 @@ struct _Sort_operation { // context for background threads for (;;) { switch (_My_ticket._Steal(_Wi)) { case _Steal_result::_Success: - _Process_sort_queue(_Basis, _Pred, _My_ticket, _Wi); + _STD _Process_sort_queue(_Basis, _Pred, _My_ticket, _Wi); break; case _Steal_result::_Abort: _My_ticket._Leave(); @@ -2722,16 +2722,16 @@ _EXPORT_STD template _Ideal = _ULast - _UFirst; if constexpr (remove_reference_t<_ExPo>::_Parallelize) { size_t _Threads; if (_Ideal > _ISORT_MAX && (_Threads = __std_parallel_algorithms_hw_threads()) > 1) { // parallelize when input is large enough and we aren't on a uniprocessor machine _TRY_BEGIN - _Sort_operation _Operation(_UFirst, _Pass_fn(_Pred), _Threads, _Ideal); // throws + _Sort_operation _Operation(_UFirst, _STD _Pass_fn(_Pred), _Threads, _Ideal); // throws const _Work_ptr _Work{_Operation}; // throws auto& _Team = _Operation._Team; auto _My_ticket = _Team._Join_team(); @@ -2739,7 +2739,7 @@ void sort(_ExPo&&, const _RanIt _First, const _RanIt _Last, _Pr _Pred) noexcept _Sort_work_item<_RanIt> _Wi{0, _Ideal, _Ideal}; _Steal_result _Sr; do { - _Process_sort_queue(_UFirst, _Pass_fn(_Pred), _My_ticket, _Wi); + _STD _Process_sort_queue(_UFirst, _STD _Pass_fn(_Pred), _My_ticket, _Wi); do { _Sr = _My_ticket._Steal(_Wi); @@ -2752,7 +2752,7 @@ void sort(_ExPo&&, const _RanIt _First, const _RanIt _Last, _Pr _Pred) noexcept } } - _Sort_unchecked(_UFirst, _ULast, _Ideal, _Pass_fn(_Pred)); + _STD _Sort_unchecked(_UFirst, _ULast, _Ideal, _STD _Pass_fn(_Pred)); } template @@ -2790,7 +2790,7 @@ struct _Static_partitioned_temporary_buffer2 { } void _Destroy_all() { // destroy each element of the temporary buffer - _Destroy_range(_Temp_buf._Data, _Temp_buf._Data + _Temp_buf._Capacity); + _STD _Destroy_range(_Temp_buf._Data, _Temp_buf._Data + _Temp_buf._Capacity); } }; @@ -2894,7 +2894,7 @@ struct _Static_partitioned_stable_sort3 { { const auto _Serial_chunk = _Basis._Get_chunk(_Key); const auto _Temp_chunk = _Temp_buf._Get_temp_buffer_for_chunk(_Key._Chunk_number); - _Stable_sort_unchecked( + _STD _Stable_sort_unchecked( _Serial_chunk._First, _Serial_chunk._Last, _Key._Size, _Temp_chunk.first, _Temp_chunk.second, _Pred); } @@ -2906,7 +2906,7 @@ struct _Static_partitioned_stable_sort3 { if (_Temp_buf._Temp_buf._Capacity >= _Team._Count) { // enough space, combine using merge { // first merge is special; constructs the elements in the temporary buffer space const size_t _Base = _Visitor._Base; - _Uninitialized_merge_move(_Basis._Get_first(_Base, _Team._Get_chunk_offset(_Base)), + _STD _Uninitialized_merge_move(_Basis._Get_first(_Base, _Team._Get_chunk_offset(_Base)), _Basis._Get_first(_Base + 1, _Team._Get_chunk_offset(_Base + 1)), _Basis._Get_first(_Base + 2, _Team._Get_chunk_offset(_Base + 2)), _Temp_buf._Get_first(_Base), _Pred); @@ -2922,8 +2922,8 @@ struct _Static_partitioned_stable_sort3 { const size_t _Base = _Visitor._Base; const size_t _Mid = _Base + _Visitor._Shift; const size_t _End = _Mid + _Visitor._Shift; - _Merge_move(_Temp_buf._Get_first(_Base), _Temp_buf._Get_first(_Mid), _Temp_buf._Get_first(_End), - _Basis._Get_first(_Base, _Team._Get_chunk_offset(_Base)), _Pred); + _STD _Merge_move(_Temp_buf._Get_first(_Base), _Temp_buf._Get_first(_Mid), + _Temp_buf._Get_first(_End), _Basis._Get_first(_Base, _Team._Get_chunk_offset(_Base)), _Pred); } if (!_Visitor._Go_to_parent()) { @@ -2940,7 +2940,7 @@ struct _Static_partitioned_stable_sort3 { const size_t _Base = _Visitor._Base; const size_t _Mid = _Base + _Visitor._Shift; const size_t _End = _Mid + _Visitor._Shift; - _Merge_move(_Basis._Get_first(_Base, _Team._Get_chunk_offset(_Base)), + _STD _Merge_move(_Basis._Get_first(_Base, _Team._Get_chunk_offset(_Base)), _Basis._Get_first(_Mid, _Team._Get_chunk_offset(_Mid)), _Basis._Get_first(_End, _Team._Get_chunk_offset(_End)), _Temp_buf._Get_first(_Base), _Pred); } @@ -2954,7 +2954,7 @@ struct _Static_partitioned_stable_sort3 { const auto _Mid_offset = _Team._Get_chunk_offset(_Mid); const auto _End_offset = _Team._Get_chunk_offset(_End); const auto _Temp_range = _Temp_buf._Get_temp_buffer_for_chunk_range(_Base, _End); - _Buffered_inplace_merge_unchecked(_Basis._Get_first(_Base, _Base_offset), + _STD _Buffered_inplace_merge_unchecked(_Basis._Get_first(_Base, _Base_offset), _Basis._Get_first(_Mid, _Mid_offset), _Basis._Get_first(_End, _End_offset), _Mid_offset - _Base_offset, _End_offset - _Mid_offset, _Temp_range.first, _Temp_range.second, _Pred); @@ -2972,7 +2972,7 @@ struct _Static_partitioned_stable_sort3 { static void __stdcall _Threadpool_callback( __std_PTP_CALLBACK_INSTANCE, void* const _Context, __std_PTP_WORK) noexcept /* terminates */ { - _Run_available_chunked_work(*static_cast<_Static_partitioned_stable_sort3*>(_Context)); + _STD _Run_available_chunked_work(*static_cast<_Static_partitioned_stable_sort3*>(_Context)); } }; @@ -2980,12 +2980,12 @@ _EXPORT_STD template (_Count), _Hw_threads); if (_Tree_height != 0) { _TRY_BEGIN - _Static_partitioned_stable_sort3 _Operation{_Temp_buf, _Count, _Tree_height, _UFirst, _Pass_fn(_Pred)}; - _Run_chunked_parallel_work(_Hw_threads, _Operation); + _Static_partitioned_stable_sort3 _Operation{ + _Temp_buf, _Count, _Tree_height, _UFirst, _STD _Pass_fn(_Pred)}; + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); return; _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below @@ -3015,7 +3016,7 @@ void stable_sort(_ExPo&&, const _BidIt _First, const _BidIt _Last, _Pr _Pred) no } } - _Stable_sort_unchecked(_UFirst, _ULast, _Count, _Temp_buf._Data, _Temp_buf._Capacity, _Pass_fn(_Pred)); + _STD _Stable_sort_unchecked(_UFirst, _ULast, _Count, _Temp_buf._Data, _Temp_buf._Capacity, _STD _Pass_fn(_Pred)); } template @@ -3060,7 +3061,7 @@ struct _Static_partitioned_is_sorted_until2 { static void __stdcall _Threadpool_callback( __std_PTP_CALLBACK_INSTANCE, void* const _Context, __std_PTP_WORK) noexcept /* terminates */ { - _Run_available_chunked_work(*static_cast<_Static_partitioned_is_sorted_until2*>(_Context)); + _STD _Run_available_chunked_work(*static_cast<_Static_partitioned_is_sorted_until2*>(_Context)); } }; @@ -3068,9 +3069,9 @@ _EXPORT_STD template ::_Parallelize) { const size_t _Hw_threads = __std_parallel_algorithms_hw_threads(); if (_Hw_threads > 1) { // parallelize on multiprocessor machines @@ -3078,9 +3079,10 @@ _NODISCARD _FwdIt is_sorted_until(_ExPo&&, _FwdIt _First, _FwdIt _Last, _Pr _Pre if (_Count >= 3) { // ... with at least 3 elements _TRY_BEGIN --_Count; // note unusual offset partitioning - _Static_partitioned_is_sorted_until2 _Operation{_UFirst, _ULast, _Hw_threads, _Count, _Pass_fn(_Pred)}; - _Run_chunked_parallel_work(_Hw_threads, _Operation); - _Seek_wrapped(_First, _Operation._Results._Get_result()); + _Static_partitioned_is_sorted_until2 _Operation{ + _UFirst, _ULast, _Hw_threads, _Count, _STD _Pass_fn(_Pred)}; + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); + _STD _Seek_wrapped(_First, _Operation._Results._Get_result()); return _First; _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below @@ -3089,7 +3091,7 @@ _NODISCARD _FwdIt is_sorted_until(_ExPo&&, _FwdIt _First, _FwdIt _Last, _Pr _Pre } } - _Seek_wrapped(_First, _STD is_sorted_until(_UFirst, _ULast, _Pass_fn(_Pred))); + _STD _Seek_wrapped(_First, _STD is_sorted_until(_UFirst, _ULast, _STD _Pass_fn(_Pred))); return _First; } @@ -3165,7 +3167,7 @@ struct _Static_partitioned_is_partitioned { const auto _Target_chunk_key = _Team._Get_chunk_key(_Target_chunk_number); const auto _Chunk = _Basis._Get_chunk(_Target_chunk_key); - const auto _This_chunk_status = _Chunk_is_partitioned_status(_Chunk._First, _Chunk._Last, _Pred); + const auto _This_chunk_status = _STD _Chunk_is_partitioned_status(_Chunk._First, _Chunk._Last, _Pred); if (_This_chunk_status == _Contains_counterexample) { // indicating that this chunk contains a counterexample, so the range is not partitioned @@ -3214,7 +3216,7 @@ struct _Static_partitioned_is_partitioned { static void __stdcall _Threadpool_callback( __std_PTP_CALLBACK_INSTANCE, void* const _Context, __std_PTP_WORK) noexcept /* terminates */ { - _Run_available_chunked_work(*static_cast<_Static_partitioned_is_partitioned*>(_Context)); + _STD _Run_available_chunked_work(*static_cast<_Static_partitioned_is_partitioned*>(_Context)); } }; @@ -3222,17 +3224,17 @@ _EXPORT_STD template ::_Parallelize) { const size_t _Hw_threads = __std_parallel_algorithms_hw_threads(); if (_Hw_threads > 1) { // parallelize on multiprocessor machines const auto _Count = _STD distance(_UFirst, _ULast); if (_Count >= 2) { // ... with at least 2 elements _TRY_BEGIN - _Static_partitioned_is_partitioned _Operation{_Hw_threads, _Count, _UFirst, _Pass_fn(_Pred)}; - _Run_chunked_parallel_work(_Hw_threads, _Operation); + _Static_partitioned_is_partitioned _Operation{_Hw_threads, _Count, _UFirst, _STD _Pass_fn(_Pred)}; + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); return _Operation._Rightmost_true.load(memory_order_relaxed) <= _Operation._Leftmost_false.load(memory_order_relaxed); _CATCH(const _Parallelism_resources_exhausted&) @@ -3242,7 +3244,7 @@ _NODISCARD bool is_partitioned(_ExPo&&, const _FwdIt _First, const _FwdIt _Last, } } - return _STD is_partitioned(_UFirst, _ULast, _Pass_fn(_Pred)); + return _STD is_partitioned(_UFirst, _ULast, _STD _Pass_fn(_Pred)); } template @@ -3393,7 +3395,7 @@ pair<_FwdIt, _Iter_diff_t<_FwdIt>> _Partition_swap_backward( ++_Beginning_of_falses; ++_Trues; if (_Beginning_of_falses == _First) { - auto _Remain = _Partition_with_count_unchecked(_First, _Last, _Pred); + auto _Remain = _STD _Partition_with_count_unchecked(_First, _Last, _Pred); return {_Remain.first, static_cast<_Iter_diff_t<_FwdIt>>(_Remain.second + _Trues)}; } } @@ -3490,17 +3492,18 @@ struct _Static_partitioned_partition2 { const auto _Range = _Basis._Get_chunk(_Key); if (_Merge_index == 0 || _Chunk_locals[_Merge_index - 1]._State.load() == _Chunk_state::_Done) { // no predecessor, so run serial algorithm directly into results - const auto _Chunk_results = _Merge_index == 0 || _Results == _Range._First - ? _Partition_with_count_unchecked(_Range._First, _Range._Last, _Pred) - : _Partition_swap_backward(_Range._First, _Range._Last, _Results, _Pred); - _Results = _Chunk_results.first; - _Chunk_data._Chunk_trues = _Chunk_results.second; + const auto _Chunk_results = + _Merge_index == 0 || _Results == _Range._First + ? _STD _Partition_with_count_unchecked(_Range._First, _Range._Last, _Pred) + : _STD _Partition_swap_backward(_Range._First, _Range._Last, _Results, _Pred); + _Results = _Chunk_results.first; + _Chunk_data._Chunk_trues = _Chunk_results.second; _Results_falses += _Key._Size - _Chunk_results.second; _Chunk_data._State.store(_Chunk_state::_Done); ++_Merge_index; // this chunk is already merged } else { // predecessor, run serial algorithm in place and attempt to merge later - auto _Chunk_results = _Partition_with_count_unchecked(_Range._First, _Range._Last, _Pred); + auto _Chunk_results = _STD _Partition_with_count_unchecked(_Range._First, _Range._Last, _Pred); _Chunk_data._Beginning_of_falses = _Chunk_results.first; _Chunk_data._Chunk_trues = _Chunk_results.second; _Chunk_data._State.store(_Chunk_state::_Merging); @@ -3536,7 +3539,7 @@ struct _Static_partitioned_partition2 { static void __stdcall _Threadpool_callback( __std_PTP_CALLBACK_INSTANCE, void* const _Context, __std_PTP_WORK) noexcept /* terminates */ { - _Run_available_chunked_work(*static_cast<_Static_partitioned_partition2*>(_Context)); + _STD _Run_available_chunked_work(*static_cast<_Static_partitioned_partition2*>(_Context)); } }; @@ -3544,18 +3547,18 @@ _EXPORT_STD template ::_Parallelize) { const size_t _Hw_threads = __std_parallel_algorithms_hw_threads(); if (_Hw_threads > 1) { const auto _Count = _STD distance(_UFirst, _ULast); if (_Count >= 2) { _TRY_BEGIN - _Static_partitioned_partition2 _Operation{_Hw_threads, _Count, _UFirst, _Pass_fn(_Pred)}; - _Run_chunked_parallel_work(_Hw_threads, _Operation); - _Seek_wrapped(_First, _Operation._Results); + _Static_partitioned_partition2 _Operation{_Hw_threads, _Count, _UFirst, _STD _Pass_fn(_Pred)}; + _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); + _STD _Seek_wrapped(_First, _Operation._Results); return _First; _CATCH(const _Parallelism_resources_exhausted&) // fall through to serial case below @@ -3564,7 +3567,7 @@ _FwdIt partition(_ExPo&&, _FwdIt _First, const _FwdIt _Last, _Pr _Pred) noexcept } } - _Seek_wrapped(_First, _STD partition(_UFirst, _ULast, _Pass_fn(_Pred))); + _STD _Seek_wrapped(_First, _STD partition(_UFirst, _ULast, _STD _Pass_fn(_Pred))); return _First; } @@ -3658,7 +3661,8 @@ template struct _Casty_plus { // Adds the two arguments together and casts the result back to _Ty. // pre: the result from adding the two arguments together can fit in _Ty - _NODISCARD constexpr _Ty operator()(_Ty _Val1, _Ty _Val2) const noexcept /* terminates */ { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _Ty operator()(_Ty _Val1, _Ty _Val2) _CONST_CALL_OPERATOR noexcept + /* terminates */ { return static_cast<_Ty>(_Val1 + _Val2); } }; @@ -5049,6 +5053,13 @@ _FwdIt2 adjacent_difference(_ExPo&&, const _FwdIt1 _First, const _FwdIt1 _Last, return _Dest; } +template +struct _Inplace_destroy_fn { + _STATIC_CALL_OPERATOR void operator()(_Ty& _Obj) _CONST_CALL_OPERATOR noexcept { + _STD _Destroy_in_place(_Obj); + } +}; + _EXPORT_STD template /* = 0 */> void destroy(_ExPo&& _Exec, const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) noexcept /* terminates */ { // destroy all elements in [_First, _Last) @@ -5056,7 +5067,7 @@ void destroy(_ExPo&& _Exec, const _NoThrowFwdIt _First, const _NoThrowFwdIt _Las _STD _Adl_verify_range(_First, _Last); using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; if constexpr (!is_trivially_destructible_v<_Ty>) { - _STD for_each(_STD forward<_ExPo>(_Exec), _First, _Last, [](_Ty& _Obj) { _STD _Destroy_in_place(_Obj); }); + _STD for_each(_STD forward<_ExPo>(_Exec), _First, _Last, _Inplace_destroy_fn<_Ty>{}); } } @@ -5074,11 +5085,18 @@ _NoThrowFwdIt destroy_n(_ExPo&& _Exec, _NoThrowFwdIt _First, const _Diff _Count_ _STD advance(_First, _Count); return _First; } else { - return _STD for_each_n( - _STD forward<_ExPo>(_Exec), _First, _Count, [](_Ty& _Obj) { _STD _Destroy_in_place(_Obj); }); + return _STD for_each_n(_STD forward<_ExPo>(_Exec), _First, _Count, _Inplace_destroy_fn<_Ty>{}); } } +template +struct _Inplace_default_construct_fn { + _STATIC_CALL_OPERATOR void operator()(_Ty& _Obj) _CONST_CALL_OPERATOR + noexcept(is_nothrow_default_constructible_v<_Ty>) { + _STD _Default_construct_in_place(_Obj); + } +}; + _EXPORT_STD template /* = 0 */> void uninitialized_default_construct(_ExPo&& _Exec, const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) noexcept /* terminates */ { @@ -5087,8 +5105,7 @@ void uninitialized_default_construct(_ExPo&& _Exec, const _NoThrowFwdIt _First, _STD _Adl_verify_range(_First, _Last); using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; if constexpr (!is_trivially_default_constructible_v<_Ty>) { - _STD for_each( - _STD forward<_ExPo>(_Exec), _First, _Last, [](_Ty& _Obj) { _STD _Default_construct_in_place(_Obj); }); + _STD for_each(_STD forward<_ExPo>(_Exec), _First, _Last, _Inplace_default_construct_fn<_Ty>{}); } } @@ -5107,11 +5124,18 @@ _NoThrowFwdIt uninitialized_default_construct_n(_ExPo&& _Exec, _NoThrowFwdIt _Fi _STD advance(_First, _Count); return _First; } else { - return _STD for_each_n( - _STD forward<_ExPo>(_Exec), _First, _Count, [](_Ty& _Obj) { _STD _Default_construct_in_place(_Obj); }); + return _STD for_each_n(_STD forward<_ExPo>(_Exec), _First, _Count, _Inplace_default_construct_fn<_Ty>{}); } } +template +struct _Inplace_value_construct_fn { + _STATIC_CALL_OPERATOR void operator()(_Ty& _Obj) _CONST_CALL_OPERATOR + noexcept(is_nothrow_default_constructible_v<_Ty>) { + _STD _Construct_in_place(_Obj); + } +}; + _EXPORT_STD template /* = 0 */> void uninitialized_value_construct(_ExPo&&, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept /* terminates */ { // value-initialize all elements in [_First, _Last) @@ -5128,10 +5152,10 @@ void uninitialized_value_construct(_ExPo&&, _NoThrowFwdIt _First, _NoThrowFwdIt auto _Count = _STD distance(_UFirst, _ULast); if (_Count >= 2) { // ... with at least 2 elements _TRY_BEGIN - using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; - auto _Ctor_fn = [](_Ty& _Obj) { _STD _Construct_in_place(_Obj); }; - _Static_partitioned_for_each2 _Operation{ - _Hw_threads, _Count, _Ctor_fn}; + using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; + using _Ctor_fn = _Inplace_value_construct_fn<_Ty>; + _Static_partitioned_for_each2 _Operation{ + _Hw_threads, _Count, _Ctor_fn{}}; _Operation._Basis._Populate(_Operation._Team, _UFirst); _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); return; @@ -5176,10 +5200,10 @@ _NoThrowFwdIt uninitialized_value_construct_n(_ExPo&&, _NoThrowFwdIt _First, con const size_t _Hw_threads = _CSTD __std_parallel_algorithms_hw_threads(); if (_Hw_threads > 1 && _Count >= 2) { // parallelize on multiprocessor machines with at least 2 elements _TRY_BEGIN - using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; - auto _Ctor_fn = [](_Ty& _Obj) { _STD _Construct_in_place(_Obj); }; - _Static_partitioned_for_each2 _Operation{ - _Hw_threads, _Count, _Ctor_fn}; + using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; + using _Ctor_fn = _Inplace_value_construct_fn<_Ty>; + _Static_partitioned_for_each2 _Operation{ + _Hw_threads, _Count, _Ctor_fn{}}; _STD _Seek_wrapped(_First, _Operation._Basis._Populate(_Operation._Team, _UFirst)); _STD _Run_chunked_parallel_work(_Hw_threads, _Operation); return _First; diff --git a/stl/inc/expected b/stl/inc/expected index 8a17025e66d..a8399d7380d 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 @@ -352,7 +352,7 @@ public: constexpr ~expected() #ifndef __clang__ // TRANSITION, LLVM-59854 noexcept -#endif // !defined(__clang__) +#endif // ^^^ no workaround ^^^ { if (_Has_value) { if constexpr (!is_trivially_destructible_v<_Ty>) { @@ -1300,7 +1300,7 @@ public: constexpr ~expected() #ifndef __clang__ // TRANSITION, LLVM-59854 noexcept -#endif // !defined(__clang__) +#endif // ^^^ no workaround ^^^ { if (!_Has_value) { _Unexpected.~_Err(); @@ -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/experimental/filesystem b/stl/inc/experimental/filesystem index bfc138fff7f..f5fb649b79b 100644 --- a/stl/inc/experimental/filesystem +++ b/stl/inc/experimental/filesystem @@ -851,7 +851,7 @@ public: path& append(const basic_string<_Elem, _Traits, _Alloc>& _Str0) { // append arbitrary source string string_type _Str(_Str0.size(), L'\0'); // convert _Elem and '/' to '\' - _STD transform(_Str0.begin(), _Str0.end(), _Str.begin(), [](const _Elem _Ch) { + _STD transform(_Str0.begin(), _Str0.end(), _Str.begin(), [](const _Elem _Ch) _STATIC_CALL_OPERATOR { auto _Wch = static_cast(_Ch); if (_Wch == _FS_SLASH) { _Wch = _FS_PREF; diff --git a/stl/inc/filesystem b/stl/inc/filesystem index a08e435d4cc..2be38683047 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -345,7 +345,7 @@ namespace filesystem { } struct _Is_slash_oper { // predicate testing if input is a preferred-separator or fallback-separator - _NODISCARD constexpr bool operator()(const wchar_t _Ch) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(const wchar_t _Ch) _CONST_CALL_OPERATOR { return _Ch == L'\\' || _Ch == L'/'; } }; @@ -2125,7 +2125,7 @@ namespace filesystem { _EXPORT_STD using file_time_type = _CHRONO time_point<_CHRONO file_clock>; #else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv using file_time_type = _CHRONO time_point; -#endif // ^^^ !_HAS_CXX20 +#endif // ^^^ !_HAS_CXX20 ^^^ struct _Dir_enum_impl; struct _Recursive_dir_enum_impl; @@ -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); @@ -4445,12 +4445,12 @@ template <> struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = filesystem::path; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const filesystem::path& _Path) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const filesystem::path& _Path) _CONST_CALL_OPERATOR noexcept { return _STD filesystem::hash_value(_Path); } }; -#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 d5e6de99b86..2146f12b5c5 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> @@ -703,6 +703,7 @@ public: explicit handle(_Ty& _Val) noexcept : _Ptr(_STD addressof(_Val)), _Format([](basic_format_parse_context<_CharType>& _Parse_ctx, _Context& _Format_ctx, const void* _Ptr) { + // TRANSITION, Clang 18, should be marked _STATIC_CALL_OPERATOR using _Td = remove_const_t<_Ty>; // doesn't drop const-qualifier per an unnumbered LWG issue using _Tq = conditional_t<_Formattable_with, const _Ty, _Ty>; @@ -1173,7 +1174,7 @@ public: __std_fs_convert_narrow_to_wide(__std_code_page{_MSVC_EXECUTION_CHARACTER_SET}, _First, 1, &_Wide, 1); _Val = _Wide; return {_First + 1, _Res._Len != 0}; -#endif // defined(_MSVC_EXECUTION_CHARACTER_SET) +#endif // ^^^ no workaround ^^^ } else { if (*_First == '\0') { _Val = U'\0'; @@ -1626,7 +1627,7 @@ inline constexpr bool _Is_signed_or_unsigned_large_integer_t = class _Width_checker { public: template - _NODISCARD constexpr unsigned long long operator()(const _Ty _Value) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr unsigned long long operator()(const _Ty _Value) _CONST_CALL_OPERATOR { if constexpr (_Is_signed_or_unsigned_large_integer_t<_Ty>) { if constexpr (is_signed_v<_Ty>) { if (_Value < 0) { @@ -1645,7 +1646,7 @@ public: class _Precision_checker { public: template - _NODISCARD constexpr unsigned long long operator()(const _Ty _Value) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr unsigned long long operator()(const _Ty _Value) _CONST_CALL_OPERATOR { if constexpr (_Is_signed_or_unsigned_large_integer_t<_Ty>) { if constexpr (is_signed_v<_Ty>) { if (_Value < 0) { @@ -4111,6 +4112,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 141d8f1d2a8..6d6df031151 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 ea1c2e63c03..3fe6623df31 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/generator b/stl/inc/generator index 4cc08ae93fc..74bbf78df2d 100644 --- a/stl/inc/generator +++ b/stl/inc/generator @@ -9,9 +9,9 @@ #include #if _STL_COMPILER_PREPROCESSOR -#if !_HAS_CXX23 || !defined(__cpp_impl_coroutine) || !defined(__cpp_lib_concepts) // TRANSITION, GH-395 -_EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later coroutine support.") -#else // ^^^ no coroutine support / coroutines vvv +#if !_HAS_CXX23 +_EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later."); +#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv #include #include @@ -195,7 +195,7 @@ public: #ifndef _PREFAST_ // TRANSITION, VSO-1662733 _NODISCARD -#endif // _PREFAST_ +#endif // ^^^ no workaround ^^^ suspend_always initial_suspend() noexcept { return {}; } @@ -260,7 +260,7 @@ private: constexpr void await_suspend(coroutine_handle<_Promise> _Handle) noexcept { #ifdef __cpp_lib_is_pointer_interconvertible // TRANSITION, LLVM-48860 _STL_INTERNAL_STATIC_ASSERT(is_pointer_interconvertible_base_of_v<_Gen_promise_base, _Promise>); -#endif // __cpp_lib_is_pointer_interconvertible +#endif // ^^^ no workaround ^^^ _Gen_promise_base& _Current = _Handle.promise(); _Current._Ptr = _STD addressof(_Val); @@ -284,7 +284,7 @@ private: _NODISCARD coroutine_handle<> await_suspend(coroutine_handle<_Promise> _Handle) noexcept { #ifdef __cpp_lib_is_pointer_interconvertible // TRANSITION, LLVM-48860 _STL_INTERNAL_STATIC_ASSERT(is_pointer_interconvertible_base_of_v<_Gen_promise_base, _Promise>); -#endif // __cpp_lib_is_pointer_interconvertible +#endif // ^^^ no workaround ^^^ _Gen_promise_base& _Current = _Handle.promise(); if (!_Current._Info) { @@ -317,7 +317,7 @@ private: _NODISCARD coroutine_handle<_Gen_promise_base> await_suspend(coroutine_handle<_Promise> _Current) noexcept { #ifdef __cpp_lib_is_pointer_interconvertible // TRANSITION, LLVM-48860 _STL_INTERNAL_STATIC_ASSERT(is_pointer_interconvertible_base_of_v<_Gen_promise_base, _Promise>); -#endif // __cpp_lib_is_pointer_interconvertible +#endif // ^^^ no workaround ^^^ auto _Target = coroutine_handle<_Gen_promise_base>::from_address(_Gen._Coro.address()); _Nested._Parent = coroutine_handle<_Gen_promise_base>::from_address(_Current.address()); _Gen_promise_base& _Parent_promise = _Nested._Parent.promise(); @@ -425,7 +425,7 @@ public: #ifdef __cpp_lib_is_pointer_interconvertible // TRANSITION, LLVM-48860 _STL_INTERNAL_STATIC_ASSERT( is_pointer_interconvertible_base_of_v<_Gen_promise_base<_Gen_yield_t<_Ref>>, promise_type>); -#endif // __cpp_lib_is_pointer_interconvertible +#endif // ^^^ no workaround ^^^ generator(generator&& _That) noexcept : _Coro(_STD exchange(_That._Coro, {})) {} @@ -468,6 +468,6 @@ _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // !_HAS_CXX23 || !defined(__cpp_impl_coroutine) +#endif // ^^^ _HAS_CXX23 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _GENERATOR_ diff --git a/stl/inc/iterator b/stl/inc/iterator index 01d6a22c2d1..fcf0fa923c6 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 74c0902b050..69f22627c20 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 c8739b9013e..a8b764723f4 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 22e8e6e7501..601c0b3874b 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 8ad20eb7cde..384a7b1e0c9 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>; @@ -57,7 +57,8 @@ namespace ranges { template _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from, iter_reference_t<_It>> - uninitialized_copy_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) const { + _STATIC_CALL_OPERATOR uninitialized_copy_result<_It, _Out> operator()( + _It _First1, _Se _Last1, _Out _First2, _OSe _Last2) _CONST_CALL_OPERATOR { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = _Uninitialized_copy_unchecked(_Unwrap_iter<_Se>(_STD move(_First1)), @@ -71,8 +72,8 @@ namespace ranges { template requires constructible_from, range_reference_t<_Rng1>> - uninitialized_copy_result, borrowed_iterator_t<_Rng2>> operator()( - _Rng1&& _Range1, _Rng2&& _Range2) const { + _STATIC_CALL_OPERATOR uninitialized_copy_result, borrowed_iterator_t<_Rng2>> + operator()(_Rng1&& _Range1, _Rng2&& _Range2) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _UResult = _Uninitialized_copy_unchecked( _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2)); @@ -120,7 +121,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 +164,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>; @@ -172,8 +173,8 @@ namespace ranges { public: template _OSe> requires constructible_from, iter_reference_t<_It>> - uninitialized_copy_n_result<_It, _Out> operator()( - _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) const { + _STATIC_CALL_OPERATOR uninitialized_copy_n_result<_It, _Out> operator()( + _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) _CONST_CALL_OPERATOR { if (_Count <= 0) { return {_STD move(_First1), _STD move(_First2)}; } @@ -212,7 +213,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,14 +238,15 @@ _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: template _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from, iter_rvalue_reference_t<_It>> - uninitialized_move_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) const { + _STATIC_CALL_OPERATOR uninitialized_move_result<_It, _Out> operator()( + _It _First1, _Se _Last1, _Out _First2, _OSe _Last2) _CONST_CALL_OPERATOR { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = _RANGES _Uninitialized_move_unchecked(_Unwrap_iter<_Se>(_STD move(_First1)), @@ -258,8 +260,8 @@ namespace ranges { template requires constructible_from, range_rvalue_reference_t<_Rng1>> - uninitialized_move_result, borrowed_iterator_t<_Rng2>> operator()( - _Rng1&& _Range1, _Rng2&& _Range2) const { + _STATIC_CALL_OPERATOR uninitialized_move_result, borrowed_iterator_t<_Rng2>> + operator()(_Rng1&& _Range1, _Rng2&& _Range2) _CONST_CALL_OPERATOR { auto _First1 = _RANGES begin(_Range1); auto _UResult = _RANGES _Uninitialized_move_unchecked( _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2)); @@ -271,7 +273,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 +327,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>; @@ -334,8 +336,8 @@ namespace ranges { public: template _OSe> requires constructible_from, iter_rvalue_reference_t<_It>> - uninitialized_move_n_result<_It, _Out> operator()( - _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) const { + _STATIC_CALL_OPERATOR uninitialized_move_n_result<_It, _Out> operator()( + _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) _CONST_CALL_OPERATOR { if (_Count <= 0) { return {_STD move(_First1), _STD move(_First2)}; } @@ -378,7 +380,7 @@ namespace ranges { public: template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se, class _Ty> requires constructible_from, const _Ty&> - _It operator()(_It _First, _Se _Last, const _Ty& _Val) const { + _STATIC_CALL_OPERATOR _It operator()(_It _First, _Se _Last, const _Ty& _Val) _CONST_CALL_OPERATOR { _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_fill_unchecked( _Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), _Val); @@ -389,7 +391,8 @@ namespace ranges { template <_No_throw_forward_range _Rng, class _Ty> requires constructible_from, const _Ty&> - borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Val) const { + _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val) _CONST_CALL_OPERATOR { return _Rewrap_iterator(_Range, _Uninitialized_fill_unchecked(_Ubegin(_Range), _Uend(_Range), _Val)); } @@ -426,7 +429,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,13 +480,14 @@ _NoThrowFwdIt uninitialized_fill_n( } #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 namespace ranges { class _Uninitialized_fill_n_fn { public: template <_No_throw_forward_iterator _It, class _Ty> requires constructible_from, const _Ty&> - _It operator()(_It _First, iter_difference_t<_It> _Count, const _Ty& _Val) const { + _STATIC_CALL_OPERATOR _It operator()( + _It _First, iter_difference_t<_It> _Count, const _Ty& _Val) _CONST_CALL_OPERATOR { if (_Count <= 0) { return _First; } @@ -517,16 +521,20 @@ namespace ranges { class _Construct_at_fn { public: - // clang-format off template requires requires(_Ty* _Ptr, _Types&&... _Args) { ::new (static_cast(_Ptr)) _Ty(static_cast<_Types&&>(_Args)...); // per LWG-3888 } - constexpr _Ty* operator()(_Ty* _Location, _Types&&... _Args) const - noexcept(noexcept(::new (static_cast(_Location)) - _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { + _STATIC_CALL_OPERATOR constexpr _Ty* operator()(_Ty* _Location, _Types&&... _Args) _CONST_CALL_OPERATOR + // clang-format off + noexcept(noexcept( + ::new(static_cast(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { // clang-format on +#ifdef __EDG__ + return _STD construct_at(_Location, _STD forward<_Types>(_Args)...); +#else // ^^^ EDG / Other vvv _MSVC_CONSTEXPR return ::new (static_cast(_Location)) _Ty(_STD forward<_Types>(_Args)...); +#endif // ^^^ Other ^^^ } }; @@ -539,7 +547,7 @@ namespace ranges { class _Destroy_at_fn { public: template - constexpr void operator()(_Ty* const _Location) const noexcept { + _STATIC_CALL_OPERATOR constexpr void operator()(_Ty* const _Location) _CONST_CALL_OPERATOR noexcept { if constexpr (is_array_v<_Ty>) { (void) _RANGES _Destroy_unchecked(_RANGES begin(*_Location), _RANGES end(*_Location)); } else { @@ -550,7 +558,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Destroy_at_fn destroy_at; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #if _HAS_CXX17 _EXPORT_STD template @@ -563,7 +571,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> @@ -583,7 +591,7 @@ namespace ranges { public: template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible> - constexpr _It operator()(_It _First, _Se _Last) const noexcept { + _STATIC_CALL_OPERATOR constexpr _It operator()(_It _First, _Se _Last) _CONST_CALL_OPERATOR noexcept { _Adl_verify_range(_First, _Last); _Seek_wrapped(_First, _RANGES _Destroy_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)))); @@ -592,7 +600,8 @@ namespace ranges { template <_No_throw_input_range _Rng> requires destructible> - constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const noexcept { + _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range) _CONST_CALL_OPERATOR noexcept { auto _First = _RANGES begin(_Range); _Seek_wrapped( _First, _RANGES _Destroy_unchecked(_Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range))); @@ -602,7 +611,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Destroy_fn destroy; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _CONSTEXPR20 _NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { @@ -628,13 +637,14 @@ _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: template <_No_throw_input_iterator _It> requires destructible> - constexpr _It operator()(_It _First, const iter_difference_t<_It> _Count_raw) const noexcept { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, const iter_difference_t<_It> _Count_raw) _CONST_CALL_OPERATOR noexcept { _Algorithm_int_t> _Count = _Count_raw; if (_Count <= 0) { return _First; @@ -658,7 +668,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Destroy_n_fn destroy_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template void uninitialized_default_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { @@ -679,13 +689,13 @@ 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: template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se> requires default_initializable> - _It operator()(_It _First, _Se _Last) const { + _STATIC_CALL_OPERATOR _It operator()(_It _First, _Se _Last) _CONST_CALL_OPERATOR { _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_default_construct_unchecked( _Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last))); @@ -696,7 +706,7 @@ namespace ranges { template <_No_throw_forward_range _Rng> requires default_initializable> - borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { + _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) _CONST_CALL_OPERATOR { auto _UResult = _Uninitialized_default_construct_unchecked(_Ubegin(_Range), _Uend(_Range)); return _Rewrap_iterator(_Range, _STD move(_UResult)); @@ -727,7 +737,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_default_construct_fn uninitialized_default_construct; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NoThrowFwdIt uninitialized_default_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { @@ -756,13 +766,13 @@ _EXPORT_STD template requires default_initializable> - _It operator()(_It _First, iter_difference_t<_It> _Count) const { + _STATIC_CALL_OPERATOR _It operator()(_It _First, iter_difference_t<_It> _Count) _CONST_CALL_OPERATOR { if (_Count <= 0) { return _First; } @@ -785,7 +795,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_default_construct_n_fn uninitialized_default_construct_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template void uninitialized_value_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { @@ -809,13 +819,13 @@ 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: template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se> requires default_initializable> - _It operator()(_It _First, _Se _Last) const { + _STATIC_CALL_OPERATOR _It operator()(_It _First, _Se _Last) _CONST_CALL_OPERATOR { _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_value_construct_unchecked( _Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last))); @@ -826,7 +836,7 @@ namespace ranges { template <_No_throw_forward_range _Rng> requires default_initializable> - borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { + _STATIC_CALL_OPERATOR borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) _CONST_CALL_OPERATOR { auto _UResult = _Uninitialized_value_construct_unchecked(_Ubegin(_Range), _Uend(_Range)); return _Rewrap_iterator(_Range, _STD move(_UResult)); @@ -855,7 +865,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_value_construct_fn uninitialized_value_construct; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _EXPORT_STD template _NoThrowFwdIt uninitialized_value_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { @@ -873,13 +883,13 @@ _EXPORT_STD template requires default_initializable> - _It operator()(_It _First, iter_difference_t<_It> _Count) const { + _STATIC_CALL_OPERATOR _It operator()(_It _First, iter_difference_t<_It> _Count) _CONST_CALL_OPERATOR { if (_Count <= 0) { return _First; } @@ -902,7 +912,7 @@ namespace ranges { _EXPORT_STD inline constexpr _Uninitialized_value_construct_n_fn uninitialized_value_construct_n; } // namespace ranges -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 #endif // _HAS_CXX17 #if _HAS_CXX20 @@ -922,11 +932,11 @@ class _CXX17_DEPRECATE_RAW_STORAGE_ITERATOR raw_storage_iterator { // wrap store public: using iterator_category = output_iterator_tag; using value_type = void; -#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 ^^^ using pointer = void; using reference = void; @@ -3660,7 +3670,7 @@ _NODISCARD bool operator<=(const unique_ptr<_Ty1, _Dx1>& _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, @@ -3671,7 +3681,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 { @@ -3737,14 +3747,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 {}; @@ -3859,7 +3869,7 @@ struct hash> { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = shared_ptr<_Ty>; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const shared_ptr<_Ty>& _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const shared_ptr<_Ty>& _Keyval) _CONST_CALL_OPERATOR noexcept { return hash::element_type*>()(_Keyval.get()); } }; @@ -4255,7 +4265,7 @@ public: }; #endif // _HAS_CXX20 -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 template struct _Pointer_of_helper {}; @@ -4457,7 +4467,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/memory_resource b/stl/inc/memory_resource index 05e77f60654..dc66ebaa365 100644 --- a/stl/inc/memory_resource +++ b/stl/inc/memory_resource @@ -556,7 +556,8 @@ namespace pmr { const size_t _Size = (_STD max)(_Bytes + sizeof(void*), _Align); const auto _Log_of_size = static_cast(_Ceiling_of_log_2(_Size)); return {_STD lower_bound(_Pools.begin(), _Pools.end(), _Log_of_size, - [](const _Pool& _Al, const unsigned char _Log) { return _Al._Log_of_size < _Log; }), + [](const _Pool& _Al, const unsigned char _Log) + _STATIC_CALL_OPERATOR { return _Al._Log_of_size < _Log; }), _Log_of_size}; } diff --git a/stl/inc/mutex b/stl/inc/mutex index 415aa79286e..2991a4f7570 100644 --- a/stl/inc/mutex +++ b/stl/inc/mutex @@ -488,7 +488,7 @@ public: : _MyMutexes(_Mtxes...) {} // construct but don't lock ~scoped_lock() noexcept { - _STD apply([](_Mutexes&... _Mtxes) { (..., (void) _Mtxes.unlock()); }, _MyMutexes); + _STD apply([](_Mutexes&... _Mtxes) _STATIC_CALL_OPERATOR { (..., (void) _Mtxes.unlock()); }, _MyMutexes); } scoped_lock(const scoped_lock&) = delete; diff --git a/stl/inc/numbers b/stl/inc/numbers index 3d27bf35f00..db2ec33f794 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 c9ffb26b598..ffd6ba05388 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>; @@ -534,7 +534,8 @@ namespace ranges { public: template _Se, weakly_incrementable _Ty> requires indirectly_writable<_It, const _Ty&> - constexpr iota_result<_It, _Ty> operator()(_It _First, _Se _Last, _Ty _Val) const { + _STATIC_CALL_OPERATOR constexpr iota_result<_It, _Ty> operator()( + _It _First, _Se _Last, _Ty _Val) _CONST_CALL_OPERATOR { _Adl_verify_range(_First, _Last); _Seek_wrapped( _First, _Iota_impl(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), _Val)); @@ -542,7 +543,8 @@ namespace ranges { } template _Rng> - constexpr iota_result, _Ty> operator()(_Rng&& _Range, _Ty _Val) const { + _STATIC_CALL_OPERATOR constexpr iota_result, _Ty> operator()( + _Rng&& _Range, _Ty _Val) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); _Seek_wrapped(_First, _Iota_impl(_Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Val)); return {_STD move(_First), _STD move(_Val)}; @@ -565,7 +567,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 47fe2d98365..9cbc960b2d8 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/ostream b/stl/inc/ostream index 1276eb0dc1a..df2dd3f6b46 100644 --- a/stl/inc/ostream +++ b/stl/inc/ostream @@ -9,11 +9,11 @@ #if _STL_COMPILER_PREPROCESSOR #include -#ifdef __cpp_lib_print +#if _HAS_CXX23 #include <__msvc_filebuf.hpp> #include <__msvc_print.hpp> #include -#endif // ^^^ defined(__cpp_lib_print) ^^^ +#endif // ^^^ _HAS_CXX23 ^^^ #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) @@ -1088,7 +1088,7 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, return _Ostr << _Errcode.category().name() << ':' << _Errcode.value(); } -#ifdef __cpp_lib_print +#if _HAS_CXX23 #ifdef _CPPRTTI template ios_base::iostate _Print_noformat_nonunicode(ostream& _Ostr, const string_view _Str) { @@ -1289,7 +1289,7 @@ void println(ostream&, format_string<_Types...>, _Types&&...) = delete; // requi _EXPORT_STD void vprint_unicode(ostream&, string_view, format_args) = delete; // requires /GR option _EXPORT_STD void vprint_nonunicode(ostream&, string_view, format_args) = delete; // requires /GR option #endif // ^^^ !defined(_CPPRTTI) ^^^ -#endif // defined(__cpp_lib_print) +#endif // _HAS_CXX23 _STD_END diff --git a/stl/inc/print b/stl/inc/print index 312962f2f6c..3d19c7aa4f5 100644 --- a/stl/inc/print +++ b/stl/inc/print @@ -7,9 +7,9 @@ #define _PRINT_ #include #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_print +#if !_HAS_CXX23 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++23 or later."); -#else // ^^^ !defined(__cpp_lib_print) / defined(__cpp_lib_print) vvv +#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv #include <__msvc_print.hpp> #include @@ -163,6 +163,6 @@ _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ defined(__cpp_lib_print) ^^^ +#endif // ^^^ _HAS_CXX23 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _PRINT_ diff --git a/stl/inc/queue b/stl/inc/queue index 9ed22d5137c..461f7054332 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 #if _STL_COMPILER_PREPROCESSOR -#ifndef __cpp_lib_ranges +#if !_HAS_CXX20 _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); -#else // ^^^ !defined(__cpp_lib_ranges) / defined(__cpp_lib_ranges) vvv +#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv #include <__msvc_int128.hpp> #include #include @@ -57,9 +57,17 @@ namespace ranges { template inline constexpr auto _Compile_time_max_size<_Ty> = (numeric_limits>::max)(); +#ifdef __EDG__ // TRANSITION, VSO-1898880 + template + concept _Constant_sized_range = sized_range<_Ty> && requires { typename _Require_constant<_Ty::size()>; }; + + template <_Constant_sized_range _Ty> + inline constexpr auto _Compile_time_max_size<_Ty> = _Ty::size(); +#else // ^^^ workaround / no workaround vvv template requires requires { typename _Require_constant<_Ty::size()>; } inline constexpr auto _Compile_time_max_size<_Ty> = _Ty::size(); +#endif // ^^^ no workaround ^^^ template inline constexpr auto _Compile_time_max_size<_Ty[_Size]> = _Size; @@ -1061,7 +1069,7 @@ namespace ranges { namespace views { struct _Single_fn { template - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(single_view>(_STD forward<_Ty>(_Val)))) requires requires { typename single_view>; @@ -1174,14 +1182,14 @@ namespace ranges { static constexpr bool _Nothrow_minus_equal<_Left, _Right> = true; public: -#endif // TRANSITION, DevCom-1347136 +#endif // ^^^ workaround ^^^ constexpr _Ioterator& operator+=(const difference_type _Off) #if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-1347136 noexcept(noexcept(_Current += _Off)) /* strengthened */ #else // ^^^ no workaround / workaround vvv noexcept(_Nothrow_plus_equal<_Wi, difference_type>) /* strengthened */ -#endif // TRANSITION, DevCom-1347136 +#endif // ^^^ workaround ^^^ requires _Advanceable<_Wi> { if constexpr (_Integer_like<_Wi>) { @@ -1205,7 +1213,7 @@ namespace ranges { noexcept(noexcept(_Current -= _Off)) /* strengthened */ #else // ^^^ no workaround / workaround vvv noexcept(_Nothrow_minus_equal<_Wi, difference_type>) /* strengthened */ -#endif // TRANSITION, DevCom-1347136 +#endif // ^^^ workaround ^^^ requires _Advanceable<_Wi> { if constexpr (_Integer_like<_Wi>) { @@ -1454,7 +1462,7 @@ namespace ranges { namespace views { struct _Iota_fn { template - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(iota_view(static_cast<_Ty&&>(_Val)))) requires requires { iota_view(static_cast<_Ty&&>(_Val)); } { @@ -1462,7 +1470,7 @@ namespace ranges { } template - _NODISCARD constexpr auto operator()(_Ty1&& _Val1, _Ty2&& _Val2) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty1&& _Val1, _Ty2&& _Val2) _CONST_CALL_OPERATOR noexcept(noexcept(iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)))) requires requires { iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)); } { @@ -1709,7 +1717,7 @@ namespace ranges { namespace views { struct _Repeat_fn { template - _NODISCARD constexpr auto operator()(_Ty&& _Value) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Value) _CONST_CALL_OPERATOR noexcept(noexcept(repeat_view(_STD forward<_Ty>(_Value)))) requires requires { repeat_view(_STD forward<_Ty>(_Value)); } { @@ -1717,7 +1725,7 @@ namespace ranges { } template - _NODISCARD constexpr auto operator()(_Ty1&& _Val1, _Ty2&& _Val2) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty1&& _Val1, _Ty2&& _Val2) _CONST_CALL_OPERATOR noexcept(noexcept(repeat_view(_STD forward<_Ty1>(_Val1), _STD forward<_Ty2>(_Val2)))) requires requires { repeat_view(_STD forward<_Ty1>(_Val1), _STD forward<_Ty2>(_Val2)); } { @@ -1823,7 +1831,7 @@ namespace ranges { struct _Istream_fn { template requires _Istreamable<_Ty, _StreamTy> - _NODISCARD constexpr auto operator()(_StreamTy& _Stream) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_StreamTy& _Stream) _CONST_CALL_OPERATOR noexcept(is_nothrow_default_constructible_v<_Ty>) /* strengthened */ { return basic_istream_view<_Ty, typename _StreamTy::char_type, typename _StreamTy::traits_type>(_Stream); } @@ -2025,7 +2033,8 @@ namespace ranges { public: template requires (_Choice<_Rng>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR + noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_View) { @@ -2161,7 +2170,8 @@ namespace ranges { public: template requires (_Choice<_Rng>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR + noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_All) { return views::all(_STD forward<_Rng>(_Range)); @@ -2420,7 +2430,7 @@ namespace ranges { namespace views { struct _Filter_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pr&& _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Pr&& _Pred) _CONST_CALL_OPERATOR noexcept(noexcept(filter_view(_STD forward<_Rng>(_Range), _STD forward<_Pr>(_Pred)))) requires requires { filter_view(static_cast<_Rng&&>(_Range), _STD forward<_Pr>(_Pred)); } { @@ -2429,7 +2439,7 @@ namespace ranges { template requires constructible_from, _Pr> - _NODISCARD constexpr auto operator()(_Pr&& _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Pr&& _Pred) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Pr>) { return _Range_closure<_Filter_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } @@ -2849,7 +2859,7 @@ namespace ranges { namespace views { struct _Transform_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Fn _Fun) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Fn _Fun) _CONST_CALL_OPERATOR noexcept(noexcept(transform_view(_STD forward<_Rng>(_Range), _STD move(_Fun)))) requires requires { transform_view(static_cast<_Rng&&>(_Range), _STD move(_Fun)); } { @@ -2858,7 +2868,7 @@ namespace ranges { template requires constructible_from, _Fn> - _NODISCARD constexpr auto operator()(_Fn&& _Fun) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Fn&& _Fun) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Fn>) { return _Range_closure<_Transform_fn, decay_t<_Fn>>{_STD forward<_Fn>(_Fun)}; } @@ -3110,8 +3120,8 @@ namespace ranges { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range, range_difference_t<_Rng> _Count) const - noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, range_difference_t<_Rng> _Count) _CONST_CALL_OPERATOR noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_Empty) { @@ -3149,7 +3159,7 @@ namespace ranges { template requires constructible_from, _Ty> - _NODISCARD constexpr auto operator()(_Ty&& _Length) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Length) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Ty>) { return _Range_closure<_Take_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Length)}; } @@ -3309,7 +3319,7 @@ namespace ranges { namespace views { struct _Take_while_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pr _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Pr _Pred) _CONST_CALL_OPERATOR noexcept(noexcept(take_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)))) requires requires { take_while_view(static_cast<_Rng&&>(_Range), _STD move(_Pred)); } { @@ -3318,7 +3328,7 @@ namespace ranges { template requires constructible_from, _Pr> - _NODISCARD constexpr auto operator()(_Pr&& _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Pr&& _Pred) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Pr>) { return _Range_closure<_Take_while_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } @@ -3513,8 +3523,8 @@ namespace ranges { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range, range_difference_t<_Rng> _Count) const - noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, range_difference_t<_Rng> _Count) _CONST_CALL_OPERATOR noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_Empty) { @@ -3555,7 +3565,7 @@ namespace ranges { template requires constructible_from, _Ty> - _NODISCARD constexpr auto operator()(_Ty&& _Length) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Length) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Ty>) { return _Range_closure<_Drop_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Length)}; } @@ -3634,7 +3644,7 @@ namespace ranges { namespace views { struct _Drop_while_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pr _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Pr _Pred) _CONST_CALL_OPERATOR noexcept(noexcept(drop_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)))) requires requires { drop_while_view(static_cast<_Rng&&>(_Range), _STD move(_Pred)); } { @@ -3643,7 +3653,7 @@ namespace ranges { template requires constructible_from, _Pr> - _NODISCARD constexpr auto operator()(_Pr&& _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Pr&& _Pred) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Pr>) { return _Range_closure<_Drop_while_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } @@ -4067,7 +4077,7 @@ namespace ranges { class _Join_fn : public _Pipe::_Base<_Join_fn> { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(join_view>{_STD forward<_Rng>(_Range)})) requires requires { join_view>{static_cast<_Rng&&>(_Range)}; } { @@ -4311,7 +4321,7 @@ namespace ranges { _NODISCARD constexpr decltype(auto) operator*() const { using _Ref = common_reference_t, iter_reference_t<_PatternIter>>; - return _Visit_inner_it<_Ref>([](auto&& _It) -> _Ref { return *_It; }); + return _Visit_inner_it<_Ref>([](auto&& _It) _STATIC_CALL_OPERATOR -> _Ref { return *_It; }); } constexpr _Iterator& operator++() { @@ -4600,7 +4610,8 @@ namespace ranges { namespace views { struct _Join_with_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pat&& _Pattern) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Pat&& _Pattern) _CONST_CALL_OPERATOR noexcept(noexcept(join_with_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)))) requires requires { join_with_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)); } { @@ -4609,7 +4620,7 @@ namespace ranges { template requires constructible_from, _Delim> - _NODISCARD constexpr auto operator()(_Delim&& _Delimiter) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Delim&& _Delimiter) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Delim>) { return _Range_closure<_Join_with_fn, decay_t<_Delim>>{_STD forward<_Delim>(_Delimiter)}; } @@ -5017,7 +5028,8 @@ namespace ranges { namespace views { struct _Lazy_split_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pat&& _Pattern) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Pat&& _Pattern) _CONST_CALL_OPERATOR noexcept(noexcept(lazy_split_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)))) requires requires { lazy_split_view(static_cast<_Rng&&>(_Range), static_cast<_Pat&&>(_Pattern)); } { @@ -5026,7 +5038,7 @@ namespace ranges { template requires constructible_from, _Delim> - _NODISCARD constexpr auto operator()(_Delim&& _Delimiter) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Delim&& _Delimiter) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Delim>) { return _Range_closure<_Lazy_split_fn, decay_t<_Delim>>{_STD forward<_Delim>(_Delimiter)}; } @@ -5202,7 +5214,8 @@ namespace ranges { namespace views { struct _Split_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pat&& _Pattern) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Pat&& _Pattern) _CONST_CALL_OPERATOR noexcept(noexcept(split_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)))) requires requires { split_view(static_cast<_Rng&&>(_Range), static_cast<_Pat&&>(_Pattern)); } { @@ -5211,7 +5224,7 @@ namespace ranges { template requires constructible_from, _Delim> - _NODISCARD constexpr auto operator()(_Delim&& _Delimiter) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Delim&& _Delimiter) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Delim>) { return _Range_closure<_Split_fn, decay_t<_Delim>>{_STD forward<_Delim>(_Delimiter)}; } @@ -5248,8 +5261,8 @@ namespace ranges { public: template requires (input_or_output_iterator> && _Choice<_It>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_It&& _First, const iter_difference_t> _Count) const - noexcept(_Choice<_It>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_It&& _First, + const iter_difference_t> _Count) _CONST_CALL_OPERATOR noexcept(_Choice<_It>._No_throw) { _STL_ASSERT(_Count >= 0, "The size passed to views::counted must be non-negative"); constexpr _St _Strat = _Choice<_It>._Strategy; @@ -5375,7 +5388,8 @@ namespace ranges { public: template requires (_Choice<_Rng>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR + noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_All) { @@ -5529,7 +5543,8 @@ namespace ranges { public: template requires (_Choice<_Rng>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR + noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_Base) { @@ -5667,7 +5682,8 @@ namespace ranges { public: template requires (_Choice<_Rng>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR + noexcept(_Choice<_Rng>._No_throw) { using _Ty = remove_cvref_t<_Rng>; constexpr _St _Strat = _Choice<_Rng>._Strategy; @@ -6102,7 +6118,7 @@ namespace ranges { class _Elements_fn : public _Pipe::_Base<_Elements_fn<_Index>> { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(elements_view, _Index>{_STD forward<_Rng>(_Range)})) requires requires { elements_view, _Index>{static_cast<_Rng&&>(_Range)}; } { @@ -6446,7 +6462,7 @@ namespace ranges { class _Enumerate_fn : public _Pipe::_Base<_Enumerate_fn> { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(enumerate_view>{_STD forward<_Rng>(_Range)})) requires requires { enumerate_view>{_STD forward<_Rng>(_Range)}; } { @@ -7045,7 +7061,8 @@ namespace ranges { namespace views { struct _Chunk_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, const range_difference_t<_Rng> _Count) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, const range_difference_t<_Rng> _Count) _CONST_CALL_OPERATOR noexcept(noexcept(chunk_view(_STD forward<_Rng>(_Range), _Count))) requires requires { chunk_view(_STD forward<_Rng>(_Range), _Count); } { @@ -7054,7 +7071,7 @@ namespace ranges { template requires constructible_from, _Ty> - _NODISCARD constexpr auto operator()(_Ty&& _Count) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Count) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Ty>) { return _Range_closure<_Chunk_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Count)}; } @@ -7443,7 +7460,8 @@ namespace ranges { namespace views { struct _Slide_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, const range_difference_t<_Rng> _Count) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, const range_difference_t<_Rng> _Count) _CONST_CALL_OPERATOR noexcept(noexcept(slide_view(_STD forward<_Rng>(_Range), _Count))) requires requires { slide_view(_STD forward<_Rng>(_Range), _Count); } { @@ -7452,7 +7470,7 @@ namespace ranges { template requires constructible_from, _Ty> - _NODISCARD constexpr auto operator()(_Ty&& _Count) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Count) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Ty>) { return _Range_closure<_Slide_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Count)}; } @@ -7645,7 +7663,7 @@ namespace ranges { namespace views { struct _Chunk_by_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pr&& _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Pr&& _Pred) _CONST_CALL_OPERATOR noexcept(noexcept(chunk_by_view(_STD forward<_Rng>(_Range), _STD forward<_Pr>(_Pred)))) requires requires { chunk_by_view(_STD forward<_Rng>(_Range), _STD forward<_Pr>(_Pred)); } { @@ -7654,7 +7672,7 @@ namespace ranges { template requires constructible_from, _Pr> - _NODISCARD constexpr auto operator()(_Pr&& _Pred) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Pr&& _Pred) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Pr>) { return _Range_closure<_Chunk_by_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } @@ -8040,7 +8058,8 @@ namespace ranges { namespace views { struct _Stride_fn { template - _NODISCARD constexpr auto operator()(_Rng&& _Range, const range_difference_t<_Rng> _Stride) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, const range_difference_t<_Rng> _Stride) _CONST_CALL_OPERATOR noexcept(noexcept(stride_view(_STD forward<_Rng>(_Range), _Stride))) requires requires { stride_view(_STD forward<_Rng>(_Range), _Stride); } { @@ -8049,7 +8068,7 @@ namespace ranges { template requires constructible_from, _Ty> - _NODISCARD constexpr auto operator()(_Ty&& _Stride) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Stride) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Ty>) { return _Range_closure<_Stride_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Stride)}; } @@ -8207,12 +8226,14 @@ namespace ranges { noexcept((noexcept(*(_STD declval>&>())) && ...)) /* strengthened */ { return _Tuple_transform( - [](auto& _Itr) noexcept(noexcept(*_Itr)) -> decltype(auto) { return *_Itr; }, _Current); + [](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(*_Itr)) -> decltype(auto) { return *_Itr; }, + _Current); } - constexpr _Iterator& operator++() noexcept(noexcept( - _Tuple_for_each([](auto& _Itr) noexcept(noexcept(++_Itr)) { ++_Itr; }, _Current))) /* strengthened */ { - _Tuple_for_each([](auto& _Itr) noexcept(noexcept(++_Itr)) { ++_Itr; }, _Current); + constexpr _Iterator& operator++() noexcept( + noexcept(_Tuple_for_each([](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(++_Itr)) { ++_Itr; }, + _Current))) /* strengthened */ { + _Tuple_for_each([](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(++_Itr)) { ++_Itr; }, _Current); return *this; } @@ -8230,11 +8251,11 @@ namespace ranges { return _Temp; } - constexpr _Iterator& operator--() noexcept(noexcept( - _Tuple_for_each([](auto& _Itr) noexcept(noexcept(--_Itr)) { --_Itr; }, _Current))) // strengthened + constexpr _Iterator& operator--() noexcept(noexcept(_Tuple_for_each( + [](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(--_Itr)) { --_Itr; }, _Current))) // strengthened requires _All_bidirectional<_IsConst, _ViewTypes...> { - _Tuple_for_each([](auto& _Itr) noexcept(noexcept(--_Itr)) { --_Itr; }, _Current); + _Tuple_for_each([](auto& _Itr) _STATIC_CALL_OPERATOR noexcept(noexcept(--_Itr)) { --_Itr; }, _Current); return *this; } @@ -8519,7 +8540,7 @@ namespace ranges { private: _NODISCARD static constexpr auto _Size_closure() noexcept { - return [](auto... _Sizes) noexcept { + return [](auto... _Sizes) _STATIC_CALL_OPERATOR noexcept { using _Common_unsigned_type = _Make_unsigned_like_t>; return (_RANGES min)({static_cast<_Common_unsigned_type>(_Sizes)...}); }; @@ -8562,7 +8583,8 @@ namespace ranges { public: template - _NODISCARD constexpr auto operator()(_Types&&... _Args) const noexcept(_Is_invocation_noexcept<_Types...>()) + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Types&&... _Args) _CONST_CALL_OPERATOR + noexcept(_Is_invocation_noexcept<_Types...>()) requires (sizeof...(_Types) == 0) || requires { zip_view...>(_STD forward<_Types>(_Args)...); } { @@ -8897,16 +8919,16 @@ namespace ranges { struct _Zip_transform_fn { private: template - static constexpr bool _Is_invocation_noexcept = []() noexcept { + _NODISCARD static consteval bool _Is_invocation_noexcept() { if constexpr (sizeof...(_Types) == 0) { return true; } else { return noexcept(zip_transform_view(_STD declval<_Func>(), _STD declval<_Types>()...)); } - }(); + } template - static constexpr bool _Enable_cpo = []() noexcept { + _NODISCARD static consteval bool _Enable_cpo() { if constexpr (sizeof...(_Types) == 0) { // This is a more efficient implementation of the CPO requirements listed in // N4950 [range.zip.transform.overview]/2.1.1. @@ -8921,13 +8943,14 @@ namespace ranges { zip_transform_view(_STD forward<_Func>(_Function), _STD forward<_Types>(_Args)...); }; } - }(); + } public: template - requires _Enable_cpo<_Func, _Types...> - _NODISCARD constexpr auto operator()(_Func&& _Function, _Types&&... _Args) const - noexcept(_Is_invocation_noexcept<_Func, _Types...>) /* strengthened */ { + requires (_Enable_cpo<_Func, _Types...>()) + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Func&& _Function, _Types&&... _Args) _CONST_CALL_OPERATOR + noexcept(_Is_invocation_noexcept<_Func, _Types...>()) /* strengthened */ { if constexpr (sizeof...(_Types) == 0) { using _Decayed_func = decay_t<_Func>; return empty_view>>{}; @@ -9055,7 +9078,8 @@ namespace ranges { : _Iterator(_Other, make_index_sequence<_Nx>{}) {} _NODISCARD constexpr auto operator*() const { - return _RANGES _Tuple_transform([](auto& _It) -> decltype(auto) { return *_It; }, _Current); + return _RANGES _Tuple_transform( + [](auto& _It) _STATIC_CALL_OPERATOR -> decltype(auto) { return *_It; }, _Current); } constexpr _Iterator& operator++() noexcept(noexcept(++_Current.front())) /* strengthened */ { @@ -9367,7 +9391,7 @@ namespace ranges { class _Adjacent_fn : public _Pipe::_Base<_Adjacent_fn<_Nx>> { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR noexcept(noexcept(adjacent_view, _Nx>{_STD forward<_Rng>(_Range)})) requires requires { adjacent_view, _Nx>{_STD forward<_Rng>(_Range)}; } { @@ -9375,7 +9399,7 @@ namespace ranges { } template - _NODISCARD constexpr auto operator()(_Rng&&) const noexcept + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&&) _CONST_CALL_OPERATOR noexcept requires (_Nx == 0) { return empty_view>{}; @@ -9712,7 +9736,7 @@ namespace ranges { class _Adjacent_transform_fn { public: template - _NODISCARD constexpr auto operator()(_Rng&&, _Fn&& _Func) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&&, _Fn&& _Func) _CONST_CALL_OPERATOR noexcept(noexcept(views::zip_transform(_STD forward<_Fn>(_Func)))) requires (_Nx == 0) && requires { views::zip_transform(_STD forward<_Fn>(_Func)); } { @@ -9720,7 +9744,7 @@ namespace ranges { } template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Fn&& _Func) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range, _Fn&& _Func) _CONST_CALL_OPERATOR noexcept(noexcept(adjacent_transform_view, decay_t<_Fn>, _Nx>( _STD forward<_Rng>(_Range), _STD forward<_Fn>(_Func)))) requires requires { @@ -9734,7 +9758,7 @@ namespace ranges { template requires constructible_from, _Fn> - _NODISCARD constexpr auto operator()(_Fn&& _Func) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Fn&& _Func) _CONST_CALL_OPERATOR noexcept(is_nothrow_constructible_v, _Fn>) { return _Range_closure<_Adjacent_transform_fn, decay_t<_Fn>>{_STD forward<_Fn>(_Func)}; } @@ -9783,7 +9807,7 @@ namespace ranges { template _NODISCARD consteval int _Cartesian_product_max_size_bit_width() { using _Size_type = decltype(_Compile_time_max_size<_Rng>); - if constexpr (requires(_Size_type _Val) { _STD bit_width(_Val); }) { + if constexpr (requires { _STD bit_width(_Compile_time_max_size<_Rng>); }) { return _STD bit_width(_Compile_time_max_size<_Rng>); } else { return numeric_limits<_Size_type>::digits; @@ -9983,7 +10007,8 @@ namespace ranges { : _Parent(_It._Parent), _Current(_STD move(_It._Current)) {} _NODISCARD constexpr auto operator*() const { - return _RANGES _Tuple_transform([](auto& _It) -> decltype(auto) { return *_It; }, _Current); + return _RANGES _Tuple_transform( + [](auto& _It) _STATIC_CALL_OPERATOR -> decltype(auto) { return *_It; }, _Current); } constexpr _Iterator& operator++() { @@ -10252,12 +10277,12 @@ namespace ranges { namespace views { class _Cartesian_product_fn { public: - _NODISCARD constexpr auto operator()() const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()() _CONST_CALL_OPERATOR noexcept { return views::single(tuple{}); } template - _NODISCARD constexpr auto operator()(_Rngs&&... _Ranges) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rngs&&... _Ranges) _CONST_CALL_OPERATOR noexcept(noexcept(cartesian_product_view...>{_STD forward<_Rngs>(_Ranges)...})) requires requires { cartesian_product_view...>{_STD forward<_Rngs>(_Ranges)...}; } { @@ -10268,7 +10293,6 @@ namespace ranges { _EXPORT_STD inline constexpr _Cartesian_product_fn cartesian_product; } // namespace views -#ifdef __cpp_lib_ranges_to_container template concept _Sized_and_reservable = sized_range<_Range> && sized_range<_Container> && requires(_Container& _Cont, const range_size_t<_Container> _Count) { @@ -10338,7 +10362,7 @@ namespace ranges { _RANGES copy(_Range, _Container_inserter>(_Cont)); return _Cont; } else if constexpr (!_Ref_converts<_Rng, _Container> && input_range>) { - const auto _Xform = [](auto&& _Elem) { + const auto _Xform = [](auto&& _Elem) _STATIC_CALL_OPERATOR { return _RANGES to>(_STD forward(_Elem)); }; return _RANGES to<_Container>(views::transform(_Range, _Xform), _STD forward<_Types>(_Args)...); @@ -10355,7 +10379,8 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT(!view<_Container>); template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Types&&... _Args) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Types&&... _Args) _CONST_CALL_OPERATOR requires requires { _RANGES to<_Container>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); } { return _RANGES to<_Container>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); @@ -10413,7 +10438,8 @@ namespace ranges { struct _To_template_fn { template ())>> - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Types&&... _Args) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()( + _Rng&& _Range, _Types&&... _Args) _CONST_CALL_OPERATOR { return _RANGES to<_Deduced>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); } }; @@ -10422,7 +10448,6 @@ namespace ranges { _NODISCARD constexpr auto to(_Types&&... _Args) { return _Range_closure<_To_template_fn<_Container>, decay_t<_Types>...>{_STD forward<_Types>(_Args)...}; } -#endif // defined(__cpp_lib_ranges_to_container) #endif // _HAS_CXX23 } // namespace ranges @@ -10434,6 +10459,6 @@ _STD_END _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) #pragma pack(pop) -#endif // ^^^ defined(__cpp_lib_ranges) ^^^ +#endif // ^^^ _HAS_CXX20 ^^^ #endif // _STL_COMPILER_PREPROCESSOR #endif // _RANGES_ diff --git a/stl/inc/regex b/stl/inc/regex index b7a291be525..db4f14feebb 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -179,7 +179,7 @@ template struct _Char_traits_eq { using _Elem = typename _Traits::char_type; - bool operator()(_Elem _Left, _Elem _Right) const noexcept { + _STATIC_CALL_OPERATOR bool operator()(_Elem _Left, _Elem _Right) _CONST_CALL_OPERATOR noexcept { return _Traits::eq(_Left, _Right); } }; @@ -188,7 +188,7 @@ template struct _Char_traits_lt { using _Elem = typename _Traits::char_type; - bool operator()(_Elem _Left, _Elem _Right) const noexcept { + _STATIC_CALL_OPERATOR bool operator()(_Elem _Left, _Elem _Right) _CONST_CALL_OPERATOR noexcept { return _Traits::lt(_Left, _Right); } }; @@ -210,7 +210,7 @@ struct _Lex_compare_memcmp_classify_pred<_Elem, _Elem, _Char_traits_lt struct _Cmp_cs { // functor to compare two character values for equality using _Elem = typename _RxTraits::char_type; - bool operator()(_Elem _Ex1, _Elem _Ex2) { + _STATIC_CALL_OPERATOR bool operator()(_Elem _Ex1, _Elem _Ex2) _CONST_CALL_OPERATOR { return _Ex1 == _Ex2; } }; @@ -2463,11 +2463,11 @@ public: } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD bool operator==(default_sentinel_t) const { return !_MyRe; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _NODISCARD const value_type& operator*() const { #if _ITERATOR_DEBUG_LEVEL != 0 @@ -2656,11 +2656,11 @@ public: } #endif // !_HAS_CXX20 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 _NODISCARD bool operator==(default_sentinel_t) const { return !_Res; } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 _NODISCARD const value_type& operator*() const { #if _ITERATOR_DEBUG_LEVEL != 0 diff --git a/stl/inc/set b/stl/inc/set index 5c228812caf..08a60f028b6 100644 --- a/stl/inc/set +++ b/stl/inc/set @@ -112,7 +112,7 @@ public: this->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 df3a5a47dfe..330f4d3887c 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 af07689db08..264c85dd759 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 e311d6e72a8..c1f012eec2a 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 32ffc28b3cb..9d84b337368 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>; @@ -396,7 +381,7 @@ template <> struct hash { // This is a C++23 feature, so argument_type and result_type are omitted. - _NODISCARD size_t operator()(const stacktrace_entry& _Val) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const stacktrace_entry& _Val) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Val.native_handle()); } }; @@ -405,7 +390,8 @@ template struct hash> { // This is a C++23 feature, so argument_type and result_type are omitted. - _NODISCARD size_t operator()(const basic_stacktrace<_Alloc>& _Val) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()( + const basic_stacktrace<_Alloc>& _Val) _CONST_CALL_OPERATOR noexcept { return _Val._Get_hash(); } }; diff --git a/stl/inc/system_error b/stl/inc/system_error index bb3f6579645..e422b473564 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 { @@ -451,7 +443,7 @@ struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = error_code; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const error_code& _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const error_code& _Keyval) _CONST_CALL_OPERATOR noexcept { return hash{}(_Keyval.value()); } }; @@ -461,7 +453,7 @@ struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = error_condition; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const error_condition& _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const error_condition& _Keyval) _CONST_CALL_OPERATOR noexcept { return hash{}(_Keyval.value()); } }; diff --git a/stl/inc/thread b/stl/inc/thread index 2d47227b132..8bd1f188f2c 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,14 +322,14 @@ public: private: _Fill_align_and_width_formatter<_CharT> _Impl; }; -#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) +#endif // _HAS_CXX23 template <> struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = thread::id; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const thread::id _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const thread::id _Keyval) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Keyval._Id); } }; diff --git a/stl/inc/tuple b/stl/inc/tuple index 217c4d70308..5ec6a1f7db8 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; @@ -186,7 +186,7 @@ template inline constexpr bool _Can_construct_values_from_tuple_like_v, _Other, index_sequence<_Indices...>> = conjunction_v(_STD declval<_Other>()))>...>; -#ifdef __clang__ // TRANSITION, LLVM-59827 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 and VSO-1900279 template concept _Can_construct_from_tuple_like = _Different_from<_TupleLike, _Tuple> && _Tuple_like<_TupleLike> && !_Is_subrange_v> @@ -195,16 +195,16 @@ concept _Can_construct_from_tuple_like = && (tuple_size_v<_Tuple> != 1 || (!is_convertible_v<_TupleLike, tuple_element_t<0, _Tuple>> && !is_constructible_v, _TupleLike>) ); -#endif // defined(__clang__) +#endif // ^^^ workaround ^^^ template >> struct _Three_way_comparison_result_with_tuple_like {}; template requires -#ifndef __clang__ // TRANSITION, DevCom-10265237 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-10265237 (sizeof...(_TTypes) == sizeof...(_Indices)) && -#endif // !defined(__clang__) +#endif // ^^^ workaround ^^^ (requires { typename _Synth_three_way_result<_TTypes, tuple_element_t<_Indices, _UTuple>>; } && ...) struct _Three_way_comparison_result_with_tuple_like, _UTuple, index_sequence<_Indices...>> { using type = common_comparison_category_t<_Synth_three_way_result<_TTypes, tuple_element_t<_Indices, _UTuple>>...>; @@ -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; @@ -432,7 +429,7 @@ public: negation_v(_STD declval<_Other>())), _This>, is_convertible(_STD declval<_Other>())), _Rest>...>>; -#ifdef __clang__ // TRANSITION, LLVM-59827 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 and VSO-1900279 template , int> = 0> #else // ^^^ workaround / no workaround vvv template <_Different_from _Other> @@ -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 -#ifdef __clang__ // TRANSITION, LLVM-59827 +#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 0d121913bf4..0eeecdc7cbe 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -327,7 +327,7 @@ struct is_convertible : bool_constant<__is_convertible_to(_From, _To)> { _EXPORT_STD template _INLINE_VAR constexpr bool is_convertible_v = __is_convertible_to(_From, _To); -#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-1627396 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1627396 template struct is_convertible<_Ty&, volatile _Ty&> : true_type {}; @@ -351,7 +351,7 @@ _INLINE_VAR constexpr bool is_convertible_v<_Ty&, const volatile _Ty&> = true; template _INLINE_VAR constexpr bool is_convertible_v = true; -#endif // ^^^ workaround +#endif // ^^^ workaround ^^^ _EXPORT_STD template struct is_enum : bool_constant<__is_enum(_Ty)> {}; // determine whether _Ty is an enumerated type @@ -700,7 +700,7 @@ struct is_trivial : bool_constant<__is_trivial(_Ty)> {}; // determine whether _T _EXPORT_STD template _INLINE_VAR constexpr bool is_trivial_v = __is_trivial(_Ty); -#endif // TRANSITION +#endif // ^^^ no workaround ^^^ _EXPORT_STD template struct is_trivially_copyable : bool_constant<__is_trivially_copyable(_Ty)> { @@ -1409,7 +1409,7 @@ struct _Add_qualifiers<_Ty1&&> { using _Apply = add_rvalue_reference_t<_Copy_cv<_Ty1, _Ty2>>; }; -#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-10095944 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-10095944 template using _Cond_res_if_right = // N4950 [meta.trans.other]/2.4 decltype(false ? _Returns_exactly<_Ty1>() : _Returns_exactly<_Ty2>()); @@ -1953,7 +1953,7 @@ _EXPORT_STD template @@ -2236,10 +2236,10 @@ 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 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1627396 is_convertible_v<_From, _To> #else // ^^^ workaround / no workaround vvv __is_convertible_to(_From, _To) @@ -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 { \ @@ -2366,7 +2366,7 @@ struct _Conditionally_enabled_hash { // conditionally enabled hash base using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Kty; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const _Kty& _Keyval) const + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const _Kty& _Keyval) _CONST_CALL_OPERATOR noexcept(noexcept(hash<_Kty>::_Do_hash(_Keyval))) /* strengthened */ { return hash<_Kty>::_Do_hash(_Keyval); } @@ -2394,7 +2394,7 @@ template <> struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = float; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const float _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const float _Keyval) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Keyval == 0.0F ? 0.0F : _Keyval); // map -0 to 0 } }; @@ -2403,7 +2403,7 @@ template <> struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = double; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const double _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const double _Keyval) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Keyval == 0.0 ? 0.0 : _Keyval); // map -0 to 0 } }; @@ -2412,7 +2412,7 @@ template <> struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = long double; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const long double _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const long double _Keyval) _CONST_CALL_OPERATOR noexcept { return _Hash_representation(_Keyval == 0.0L ? 0.0L : _Keyval); // map -0 to 0 } }; @@ -2421,7 +2421,7 @@ template <> struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = nullptr_t; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(nullptr_t) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(nullptr_t) _CONST_CALL_OPERATOR noexcept { void* _Null{}; return _Hash_representation(_Null); } diff --git a/stl/inc/typeindex b/stl/inc/typeindex index 3e1effeaf78..7f74cde2a76 100644 --- a/stl/inc/typeindex +++ b/stl/inc/typeindex @@ -81,7 +81,7 @@ struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = type_index; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const type_index& _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(const type_index& _Keyval) _CONST_CALL_OPERATOR noexcept { return _Keyval.hash_code(); } }; diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index ae1560c4e86..0cb181592a0 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 be7caa0b280..72d5bfda78e 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 74af5968727..ea7f440dbf4 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>>; @@ -209,14 +206,14 @@ concept _Tuple_like = _Tuple_like_impl>; template concept _Pair_like = _Tuple_like<_Ty> && tuple_size_v> == 2; -#ifdef __clang__ // TRANSITION, LLVM-59827 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-59827 and VSO-1900279 template concept _Can_construct_from_pair_like = _Pair_like<_PairLike> && !_Is_subrange_v> && is_constructible_v<_Ty1, decltype(_STD get<0>(_STD declval<_PairLike>()))> && is_constructible_v<_Ty2, decltype(_STD get<1>(_STD declval<_PairLike>()))>; -#endif // defined(__clang__) +#endif // ^^^ workaround ^^^ #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 -#ifdef __clang__ // TRANSITION, LLVM-59827 +#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 071271d8682..0c32c892a19 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -509,7 +509,7 @@ public: return _STD move(_Head)._Item; } }; -#endif // defined(__cplusplus_winrt) +#endif // ^^^ workaround ^^^ template _NODISCARD constexpr decltype(auto) _Variant_raw_get(_Storage&& _Obj) noexcept { @@ -1088,7 +1088,7 @@ public: #ifdef __clang__ // TRANSITION, LLVM-45398 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-lambda-capture" -#endif // TRANSITION, LLVM-45398 +#endif // ^^^ workaround ^^^ _CONSTEXPR20 void swap(variant& _That) noexcept( conjunction_v..., is_nothrow_swappable<_Types>...>) { // exchange the contained values if *this and _That hold the same alternative, otherwise exchange the values of @@ -1149,7 +1149,7 @@ public: } #ifdef __clang__ // TRANSITION, LLVM-45398 #pragma clang diagnostic pop -#endif // TRANSITION, LLVM-45398 +#endif // ^^^ workaround ^^^ private: template @@ -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 = @@ -1425,7 +1425,9 @@ struct _Variant_dispatcher> { template _NODISCARD static constexpr _Ret _Dispatch2(_Callable&& _Obj, _Types&&... _Args) { if constexpr (_Any_valueless) { - ((void) _Args, ...); // TRANSITION, VSO-1513409 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1513409 + ((void) _Args, ...); +#endif // ^^^ workaround ^^^ _STD _Throw_bad_variant_access(); } #if _HAS_CXX20 @@ -1689,7 +1691,7 @@ _CONSTEXPR20 void swap(variant<_Types...>& _Left, variant<_Types...>& _Right) no struct _Variant_hash_visitor { // visitation function for hashing variants template - _NODISCARD size_t operator()(_Tagged _Obj) const + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(_Tagged _Obj) _CONST_CALL_OPERATOR noexcept(disjunction_v, is_nothrow_invocable, const _Ty&>>) { // hash contained value _Obj if constexpr (_Idx == variant_npos) { // hash a valueless variant @@ -1715,7 +1717,7 @@ struct hash { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = monostate; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(monostate) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()(monostate) _CONST_CALL_OPERATOR noexcept { return 1729; // Arbitrary value } }; diff --git a/stl/inc/vector b/stl/inc/vector index 01293cec40a..0fe611ef9f7 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; @@ -2259,15 +2259,16 @@ _NODISCARD bool operator!=(const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _ template struct _Vbase_compare_three_way { - _NODISCARD constexpr _Ret operator()(const _Vbase _Left, const _Vbase _Right) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _Ret operator()( + const _Vbase _Left, const _Vbase _Right) _CONST_CALL_OPERATOR noexcept { 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 +2277,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 +2310,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 +2352,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 +2902,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 +2913,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 +3239,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 +3256,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 +3314,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 +3341,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 +3362,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 +3387,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); @@ -3563,7 +3564,8 @@ struct hash> { using _ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = vector; using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = size_t; - _NODISCARD size_t operator()(const vector& _Keyval) const noexcept { + _NODISCARD _STATIC_CALL_OPERATOR size_t operator()( + const vector& _Keyval) _CONST_CALL_OPERATOR noexcept { return _Hash_array_representation(_Keyval._Myvec.data(), _Keyval._Myvec.size()); } }; @@ -3575,7 +3577,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 +3595,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 a2f8ded5e75..e36e68e5e0d 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 2839843709c..1e524c0b1da 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 c34ee4fd0ec..5db569ed96b 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -346,7 +346,7 @@ template <> struct char_traits : _WChar_traits {}; #endif // defined(_CRTBLD) -#if defined(__cpp_char8_t) && !defined(__EDG__) && !defined(__clang__) +#if defined(__cpp_char8_t) && !defined(__clang__) && !defined(__EDG__) #define _HAS_U8_INTRINSICS 1 #else // ^^^ Use intrinsics for char8_t / don't use said intrinsics vvv #define _HAS_U8_INTRINSICS 0 @@ -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())) { @@ -3319,7 +3319,7 @@ public: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem* const _Ptr, - const size_type _Count) { + const size_type _Count) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size); _Traits::copy(_New_ptr + _Old_size, _Ptr, _Count); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); @@ -3346,7 +3346,7 @@ public: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Count, - const _Elem _Ch) { + const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size); _Traits::assign(_New_ptr + _Old_size, _Count, _Ch); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); @@ -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; @@ -3424,7 +3424,7 @@ public: return _Reallocate_for( _Count, - [](_Elem* const _New_ptr, const size_type _Count, const _Elem* const _Ptr) { + [](_Elem* const _New_ptr, const size_type _Count, const _Elem* const _Ptr) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Ptr, _Count); _Traits::assign(_New_ptr[_Count], _Elem()); }, @@ -3448,7 +3448,7 @@ public: return _Reallocate_for( _Count, - [](_Elem* const _New_ptr, const size_type _Count, const _Elem _Ch) { + [](_Elem* const _New_ptr, const size_type _Count, const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::assign(_New_ptr, _Count, _Ch); _Traits::assign(_New_ptr[_Count], _Elem()); }, @@ -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 @@ -3564,7 +3564,7 @@ public: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const _Elem* const _Ptr, const size_type _Count) { + const _Elem* const _Ptr, const size_type _Count) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::copy(_New_ptr + _Off, _Ptr, _Count); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, _Old_size - _Off + 1); @@ -3595,7 +3595,7 @@ public: return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const size_type _Count, const _Elem _Ch) { + const size_type _Count, const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::assign(_New_ptr + _Off, _Count, _Ch); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, _Old_size - _Off + 1); @@ -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); @@ -3807,7 +3807,7 @@ public: return _Reallocate_grow_by( _Growth, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const size_type _Nx, const _Elem* const _Ptr, const size_type _Count) { + const size_type _Nx, const _Elem* const _Ptr, const size_type _Count) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::copy(_New_ptr + _Off, _Ptr, _Count); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, _Old_size - _Nx - _Off + 1); @@ -3847,7 +3847,7 @@ public: return _Reallocate_grow_by( _Count - _Nx, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, - const size_type _Nx, const size_type _Count, const _Elem _Ch) { + const size_type _Nx, const size_type _Count, const _Elem _Ch) _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::assign(_New_ptr + _Off, _Count, _Ch); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, _Old_size - _Nx - _Off + 1); @@ -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)); @@ -4096,11 +4096,12 @@ public: _Reallocate_grow_by( 1, - [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem _Ch) { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size); - _Traits::assign(_New_ptr[_Old_size], _Ch); - _Traits::assign(_New_ptr[_Old_size + 1], _Elem()); - }, + [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem _Ch) + _STATIC_CALL_OPERATOR { + _Traits::copy(_New_ptr, _Old_ptr, _Old_size); + _Traits::assign(_New_ptr[_Old_size], _Ch); + _Traits::assign(_New_ptr[_Old_size + 1], _Elem()); + }, _Ch); } @@ -4195,9 +4196,8 @@ public: (_CRT_GUARDOVERFLOW const size_type _New_size, _Operation _Op) { if (_Mypair._Myval2._Myres < _New_size) { _Reallocate_grow_by(_New_size - _Mypair._Myval2._Mysize, - [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); - }); + [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); } else { _ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _New_size); _Mypair._Myval2._Mysize = _New_size; @@ -4233,10 +4233,9 @@ public: } const size_type _Old_size = _Mypair._Myval2._Mysize; - _Reallocate_grow_by( - _Newcap - _Old_size, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); - }); + _Reallocate_grow_by(_Newcap - _Old_size, + [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); _Mypair._Myval2._Mysize = _Old_size; } @@ -4258,10 +4257,9 @@ public: if (_Mypair._Myval2._Myres < _Newcap) { // reallocate to grow const size_type _Old_size = _Mypair._Myval2._Mysize; - _Reallocate_grow_by( - _Newcap - _Old_size, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) { - _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); - }); + _Reallocate_grow_by(_Newcap - _Old_size, + [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) + _STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); _Mypair._Myval2._Mysize = _Old_size; return; @@ -4917,12 +4915,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 ce5f7eabf9a..63d4e1224dc 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 b8a1b6995ef..f2634616e0f 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -48,6 +48,18 @@ _STL_DISABLE_CLANG_WARNINGS #endif // ^^^ _USE_STD_VECTOR_ALGORITHMS != 0 ^^^ #endif // ^^^ no support for vector algorithms ^^^ +#ifndef _USE_STD_VECTOR_FLOATING_ALGORITHMS +#if _USE_STD_VECTOR_ALGORITHMS && !defined(_M_FP_EXCEPT) +#define _USE_STD_VECTOR_FLOATING_ALGORITHMS 1 +#else // ^^^ use vector algorithms and fast math / not use vector algorithms or not use fast math vvv +#define _USE_STD_VECTOR_FLOATING_ALGORITHMS 0 +#endif // ^^^ not use vector algorithms or not use fast math ^^^ +#else // ^^^ !defined(_USE_STD_VECTOR_FLOATING_ALGORITHMS) / defined(_USE_STD_VECTOR_FLOATING_ALGORITHMS) vvv +#if _USE_STD_VECTOR_FLOATING_ALGORITHMS && !_USE_STD_VECTOR_ALGORITHMS +#error _USE_STD_VECTOR_FLOATING_ALGORITHMS must imply _USE_STD_VECTOR_ALGORITHMS. +#endif // _USE_STD_VECTOR_FLOATING_ALGORITHMS && !_USE_STD_VECTOR_ALGORITHMS +#endif // ^^^ defined(_USE_STD_VECTOR_FLOATING_ALGORITHMS) ^^^ + #if _USE_STD_VECTOR_ALGORITHMS extern "C" { // The "noalias" attribute tells the compiler optimizer that pointers going into these hand-vectorized algorithms @@ -87,11 +99,15 @@ const void* __stdcall __std_min_element_1(const void* _First, const void* _Last, const void* __stdcall __std_min_element_2(const void* _First, const void* _Last, bool _Signed) noexcept; const void* __stdcall __std_min_element_4(const void* _First, const void* _Last, bool _Signed) noexcept; const void* __stdcall __std_min_element_8(const void* _First, const void* _Last, bool _Signed) noexcept; +const void* __stdcall __std_min_element_f(const void* _First, const void* _Last, bool _Unused) noexcept; +const void* __stdcall __std_min_element_d(const void* _First, const void* _Last, bool _Unused) noexcept; const void* __stdcall __std_max_element_1(const void* _First, const void* _Last, bool _Signed) noexcept; const void* __stdcall __std_max_element_2(const void* _First, const void* _Last, bool _Signed) noexcept; const void* __stdcall __std_max_element_4(const void* _First, const void* _Last, bool _Signed) noexcept; const void* __stdcall __std_max_element_8(const void* _First, const void* _Last, bool _Signed) noexcept; +const void* __stdcall __std_max_element_f(const void* _First, const void* _Last, bool _Unused) noexcept; +const void* __stdcall __std_max_element_d(const void* _First, const void* _Last, bool _Unused) noexcept; } // extern "C" _STD_BEGIN @@ -158,7 +174,11 @@ template _Ty* __std_min_element(_Ty* _First, _Ty* _Last) noexcept { constexpr bool _Signed = _STD is_signed_v<_Ty>; - if constexpr (sizeof(_Ty) == 1) { + if constexpr (_STD is_same_v<_STD remove_const_t<_Ty>, float>) { + return const_cast<_Ty*>(static_cast(::__std_min_element_f(_First, _Last, false))); + } else if constexpr (_STD _Is_any_of_v<_STD remove_const_t<_Ty>, double, long double>) { + return const_cast<_Ty*>(static_cast(::__std_min_element_d(_First, _Last, false))); + } else if constexpr (sizeof(_Ty) == 1) { return const_cast<_Ty*>(static_cast(::__std_min_element_1(_First, _Last, _Signed))); } else if constexpr (sizeof(_Ty) == 2) { return const_cast<_Ty*>(static_cast(::__std_min_element_2(_First, _Last, _Signed))); @@ -175,7 +195,11 @@ template _Ty* __std_max_element(_Ty* _First, _Ty* _Last) noexcept { constexpr bool _Signed = _STD is_signed_v<_Ty>; - if constexpr (sizeof(_Ty) == 1) { + if constexpr (_STD is_same_v<_STD remove_const_t<_Ty>, float>) { + return const_cast<_Ty*>(static_cast(::__std_max_element_f(_First, _Last, false))); + } else if constexpr (_STD _Is_any_of_v<_STD remove_const_t<_Ty>, double, long double>) { + return const_cast<_Ty*>(static_cast(::__std_max_element_d(_First, _Last, false))); + } else if constexpr (sizeof(_Ty) == 1) { return const_cast<_Ty*>(static_cast(::__std_max_element_1(_First, _Last, _Signed))); } else if constexpr (sizeof(_Ty) == 2) { return const_cast<_Ty*>(static_cast(::__std_max_element_2(_First, _Last, _Signed))); @@ -230,7 +254,7 @@ struct _Get_rebind_alias<_Ty, _Other, void_t(_STD declval<_Ty*>())) _Ty(_STD declval<_Types>()...))>> @@ -238,7 +262,7 @@ _EXPORT_STD template (_STD declval<_Ty*>())) _Ty(_STD declval<_Types>()...))>* = nullptr> -#endif // TRANSITION, DevCom-1691516 +#endif // ^^^ workaround ^^^ constexpr _Ty* construct_at(_Ty* const _Location, _Types&&... _Args) noexcept( noexcept(::new(static_cast(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { _MSVC_CONSTEXPR return ::new (static_cast(_Location)) _Ty(_STD forward<_Types>(_Args)...); @@ -311,20 +335,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 +612,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>; @@ -646,7 +661,8 @@ namespace ranges { public: template requires (_Choice<_Ty>._Strategy != _St::_None) - _NODISCARD constexpr decltype(auto) operator()(_Ty && _Val) const noexcept(_Choice<_Ty>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr decltype(auto) operator()(_Ty && _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty>._No_throw) { constexpr _St _Strat = _Choice<_Ty>._Strategy; if constexpr (_Strat == _St::_Custom) { @@ -987,7 +1003,8 @@ namespace ranges { public: template requires (_Choice<_Ty1, _Ty2>._Strategy != _St::_None) - constexpr void operator()(_Ty1&& _Val1, _Ty2&& _Val2) const noexcept(_Choice<_Ty1, _Ty2>._No_throw) { + _STATIC_CALL_OPERATOR constexpr void operator()(_Ty1&& _Val1, _Ty2&& _Val2) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty1, _Ty2>._No_throw) { constexpr _St _Strat = _Choice<_Ty1, _Ty2>._Strategy; if constexpr (_Strat == _St::_Custom) { @@ -1046,7 +1063,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 +1075,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 +1097,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 +1107,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 +1117,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 +1127,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 +1515,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 +1538,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 +1571,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 +1635,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 +1655,7 @@ public: --_RTmp; _RANGES iter_swap(_LTmp, _RTmp); } -#endif // defined(__cpp_lib_concepts) +#endif // _HAS_CXX20 using _Prevent_inheriting_unwrap = reverse_iterator; @@ -1684,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(); } @@ -1697,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(); } @@ -1710,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(); } @@ -1723,11 +1740,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 +1753,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 +1766,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 +1804,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 +1979,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>>; @@ -2379,7 +2396,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Array) { @@ -2454,7 +2472,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Array) { @@ -2592,7 +2611,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -2642,7 +2662,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -2708,13 +2729,13 @@ namespace ranges { typename const_iterator<_Begin_on_const<_Ty>>; const_iterator<_Begin_on_const<_Ty>>{_RANGES begin(_RANGES _Possibly_const_range(_Val))}; } - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept( + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept( noexcept(const_iterator<_Begin_on_const<_Ty>>{_RANGES begin(_RANGES _Possibly_const_range(_Val))})) { return const_iterator<_Begin_on_const<_Ty>>{_RANGES begin(_RANGES _Possibly_const_range(_Val))}; } #else // ^^^ C++23 / C++20 vvv template > - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES begin(static_cast<_CTy&&>(_Val)))) requires requires { _RANGES begin(static_cast<_CTy&&>(_Val)); } { @@ -2738,13 +2759,13 @@ namespace ranges { typename const_sentinel<_End_on_const<_Ty>>; const_sentinel<_End_on_const<_Ty>>{_RANGES end(_RANGES _Possibly_const_range(_Val))}; } - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(const_sentinel<_End_on_const<_Ty>>{_RANGES end(_RANGES _Possibly_const_range(_Val))})) { return const_sentinel<_End_on_const<_Ty>>{_RANGES end(_RANGES _Possibly_const_range(_Val))}; } #else // ^^^ C++23 / C++20 vvv template > - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES end(static_cast<_CTy&&>(_Val)))) requires requires { _RANGES end(static_cast<_CTy&&>(_Val)); } { @@ -2805,7 +2826,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -2875,7 +2897,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -2906,13 +2929,13 @@ namespace ranges { typename const_iterator<_Rbegin_on_const<_Ty>>; const_iterator<_Rbegin_on_const<_Ty>>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))}; } - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept( + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept( noexcept(const_iterator<_Rbegin_on_const<_Ty>>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))})) { return const_iterator<_Rbegin_on_const<_Ty>>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))}; } #else // ^^^ C++23 / C++20 vvv template > - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES rbegin(static_cast<_CTy&&>(_Val)))) requires requires { _RANGES rbegin(static_cast<_CTy&&>(_Val)); } { @@ -2936,13 +2959,13 @@ namespace ranges { typename const_sentinel<_Rend_on_const<_Ty>>; const_sentinel<_Rend_on_const<_Ty>>{_RANGES rend(_RANGES _Possibly_const_range(_Val))}; } - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(const_sentinel<_Rend_on_const<_Ty>>{_RANGES rend(_RANGES _Possibly_const_range(_Val))})) { return const_sentinel<_Rend_on_const<_Ty>>{_RANGES rend(_RANGES _Possibly_const_range(_Val))}; } #else // ^^^ C++23 / C++20 vvv template > - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES rend(static_cast<_CTy&&>(_Val)))) requires requires { _RANGES rend(static_cast<_CTy&&>(_Val)); } { @@ -3015,7 +3038,8 @@ namespace ranges { public: template requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Array) { @@ -3080,7 +3104,8 @@ namespace ranges { public: template requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr bool operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr bool operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -3136,7 +3161,8 @@ namespace ranges { public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) - _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR + noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -3160,13 +3186,13 @@ namespace ranges { requires requires(_Ty& _Val) { // _RANGES _As_const_pointer(_RANGES data(_RANGES _Possibly_const_range(_Val))); } - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES data(_RANGES _Possibly_const_range(_Val)))) { return _RANGES _As_const_pointer(_RANGES data(_RANGES _Possibly_const_range(_Val))); } #else // ^^^ C++23 / C++20 vvv template > - _NODISCARD constexpr auto operator()(_Ty&& _Val) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Ty&& _Val) _CONST_CALL_OPERATOR noexcept(noexcept(_RANGES data(static_cast<_CTy&&>(_Val)))) requires requires { _RANGES data(static_cast<_CTy&&>(_Val)); } { @@ -3222,7 +3248,7 @@ namespace ranges { class _Advance_fn { public: template - constexpr void operator()(_It& _Where, iter_difference_t<_It> _Off) const { + _STATIC_CALL_OPERATOR constexpr void operator()(_It& _Where, iter_difference_t<_It> _Off) _CONST_CALL_OPERATOR { if constexpr (random_access_iterator<_It>) { _Where += _Off; } else { @@ -3250,11 +3276,11 @@ namespace ranges { } template _Se> - constexpr void operator()(_It& _Where, _Se _Last) const { + _STATIC_CALL_OPERATOR constexpr void operator()(_It& _Where, _Se _Last) _CONST_CALL_OPERATOR { if constexpr (assignable_from<_It&, _Se>) { _Where = static_cast<_Se&&>(_Last); } else if constexpr (sized_sentinel_for<_Se, _It>) { - (*this)(_Where, _Last - _Where); + operator()(_Where, _Last - _Where); } else { _Adl_verify_range(_Where, _Last); @@ -3273,19 +3299,20 @@ namespace ranges { } template _Se> - constexpr iter_difference_t<_It> operator()(_It& _Where, iter_difference_t<_It> _Off, _Se _Last) const { + _STATIC_CALL_OPERATOR constexpr iter_difference_t<_It> operator()( + _It& _Where, iter_difference_t<_It> _Off, _Se _Last) _CONST_CALL_OPERATOR { if constexpr (sized_sentinel_for<_Se, _It>) { const iter_difference_t<_It> _Delta = _Last - _Where; if ((_Off < 0 && _Off <= _Delta) || (_Off > 0 && _Off >= _Delta)) { if constexpr (assignable_from<_It&, _Se>) { _Where = static_cast<_Se&&>(_Last); } else { - (*this)(_Where, _Delta); + operator()(_Where, _Delta); } return _Off - _Delta; } - (*this)(_Where, _Off); + operator()(_Where, _Off); return 0; } else { // performance note: develop unwrapping technology for (i, n, s)? @@ -3312,22 +3339,23 @@ namespace ranges { public: template _Se> requires (!sized_sentinel_for<_Se, _It>) - _NODISCARD constexpr iter_difference_t<_It> operator()(_It _First, _Se _Last) const - noexcept(noexcept(_Distance_unchecked( - _Get_unwrapped(_STD move(_First)), _Get_unwrapped(_STD move(_Last))))) /* strengthened */ { + _NODISCARD _STATIC_CALL_OPERATOR constexpr iter_difference_t<_It> operator()(_It _First, + _Se _Last) _CONST_CALL_OPERATOR noexcept(noexcept(_Distance_unchecked(_Get_unwrapped(_STD move(_First)), + _Get_unwrapped(_STD move(_Last))))) /* strengthened */ { _Adl_verify_range(_First, _Last); return _Distance_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last))); } template > _Se> - _NODISCARD constexpr iter_difference_t> operator()(_It&& _First, const _Se _Last) const + _NODISCARD _STATIC_CALL_OPERATOR constexpr iter_difference_t> operator()( + _It&& _First, const _Se _Last) _CONST_CALL_OPERATOR noexcept(noexcept(_Last - static_cast&>(_First))) /* strengthened */ { return _Last - static_cast&>(_First); } template - _NODISCARD constexpr range_difference_t<_Rng> operator()(_Rng&& _Range) const - noexcept(_Nothrow_size<_Rng>) /* strengthened */ { + _NODISCARD _STATIC_CALL_OPERATOR constexpr range_difference_t<_Rng> operator()( + _Rng&& _Range) _CONST_CALL_OPERATOR noexcept(_Nothrow_size<_Rng>) /* strengthened */ { if constexpr (sized_range<_Rng>) { return static_cast>(_RANGES size(_Range)); } else { @@ -3362,7 +3390,8 @@ namespace ranges { class _Ssize_fn { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(noexcept(_RANGES size(_Range))) + _NODISCARD _STATIC_CALL_OPERATOR constexpr auto operator()(_Rng&& _Range) _CONST_CALL_OPERATOR + noexcept(noexcept(_RANGES size(_Range))) requires requires { _RANGES size(_Range); } { using _Sty = _Make_signed_like_t; @@ -3378,25 +3407,27 @@ namespace ranges { class _Next_fn { public: template - _NODISCARD constexpr _It operator()(_It _Where) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()(_It _Where) _CONST_CALL_OPERATOR { ++_Where; return _Where; } template - _NODISCARD constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _Where, const iter_difference_t<_It> _Off) _CONST_CALL_OPERATOR { _RANGES advance(_Where, _Off); return _Where; } template _Se> - _NODISCARD constexpr _It operator()(_It _Where, _Se _Last) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()(_It _Where, _Se _Last) _CONST_CALL_OPERATOR { _RANGES advance(_Where, static_cast<_Se&&>(_Last)); return _Where; } template _Se> - _NODISCARD constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off, _Se _Last) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _Where, const iter_difference_t<_It> _Off, _Se _Last) _CONST_CALL_OPERATOR { _RANGES advance(_Where, _Off, static_cast<_Se&&>(_Last)); return _Where; } @@ -3407,20 +3438,22 @@ namespace ranges { class _Prev_fn { public: template - _NODISCARD constexpr _It operator()(_It _Where) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()(_It _Where) _CONST_CALL_OPERATOR { --_Where; return _Where; } template - _NODISCARD constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _Where, const iter_difference_t<_It> _Off) _CONST_CALL_OPERATOR { _STL_ASSERT(_Off != _Min_possible_v>, "integer overflow"); _RANGES advance(_Where, -_Off); return _Where; } template - _NODISCARD constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off, _It _Last) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _Where, const iter_difference_t<_It> _Off, _It _Last) _CONST_CALL_OPERATOR { _STL_ASSERT(_Off != _Min_possible_v>, "integer overflow"); _RANGES advance(_Where, -_Off, static_cast<_It&&>(_Last)); return _Where; @@ -3943,14 +3976,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,22 +3996,25 @@ 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> { +private: + _Iter _Current{}; + public: using iterator_type = _Iter; using value_type = _Iter_value_t<_Iter>; 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>) { @@ -3996,10 +4032,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; @@ -4007,49 +4043,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 */ { @@ -4063,17 +4099,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 */ { @@ -4123,16 +4159,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( @@ -4162,18 +4198,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; @@ -4211,20 +4247,17 @@ public: _NODISCARD constexpr iterator_type&& _Get_current() && noexcept { return _STD move(_Current); } - -private: - iterator_type _Current{}; }; _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 +4274,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 +4286,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 +4296,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 +4306,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 +4332,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 +4347,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 +4364,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 +4379,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 +4389,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 +4478,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 +4552,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 +4574,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 +4593,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 +4633,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>; @@ -4721,7 +4754,8 @@ namespace ranges { public: template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> - constexpr copy_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr copy_result<_It, _Out> operator()( + _It _First, _Se _Last, _Out _Result) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _RANGES _Copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result)); @@ -4731,7 +4765,8 @@ namespace ranges { template requires indirectly_copyable, _Out> - constexpr copy_result, _Out> operator()(_Rng&& _Range, _Out _Result) const { + _STATIC_CALL_OPERATOR constexpr copy_result, _Out> operator()( + _Rng&& _Range, _Out _Result) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _RANGES _Copy_unchecked( _RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result)); @@ -4742,7 +4777,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,12 +5121,13 @@ _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: template _It> - constexpr _It operator()(_It _First, iter_difference_t<_It> _Count, const _Ty& _Value) const { + _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, iter_difference_t<_It> _Count, const _Ty& _Value) _CONST_CALL_OPERATOR { if (_Count > 0) { auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count); if (!_STD is_constant_evaluated()) { @@ -5121,7 +5157,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 +5221,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 +5361,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) { @@ -5392,8 +5428,8 @@ namespace ranges { template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr mismatch_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, - _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr mismatch_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, + _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); @@ -5424,8 +5460,10 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr mismatch_result, borrowed_iterator_t<_Rng2>> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD + _STATIC_CALL_OPERATOR constexpr mismatch_result, borrowed_iterator_t<_Rng2>> + operator()(_Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, + _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { range_difference_t<_Rng1> _Count1 = _RANGES distance(_Range1); const range_difference_t<_Rng2> _Count2 = _RANGES distance(_Range2); @@ -5456,7 +5494,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 +5536,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 +5546,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 +5617,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 +5704,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 +5859,7 @@ _EXPORT_STD template concept _Sized_or_unreachable_sentinel_for = sized_sentinel_for<_Se, _It> || same_as<_Se, unreachable_sentinel_t>; @@ -5906,7 +5944,8 @@ namespace ranges { public: template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _RANGES _Find_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _Val, _STD _Pass_fn(_Proj)); @@ -5917,8 +5956,8 @@ namespace ranges { template requires indirect_binary_predicate, _Pj>, const _Ty*> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()( - _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _RANGES _Find_unchecked( _RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Val, _STD _Pass_fn(_Proj)); @@ -5930,7 +5969,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 +6318,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) { @@ -6325,7 +6364,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _RANGES _Find_if_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -6336,7 +6376,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _RANGES _Find_if_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -6352,7 +6393,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Find_if_not_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -6364,7 +6406,8 @@ namespace ranges { template , _Pj>> _Pr> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _First = _RANGES begin(_Range); auto _UResult = _Find_if_not_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), @@ -6397,7 +6440,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_binary_predicate, projected<_It, _Pj>> _Pr = ranges::equal_to> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); auto _UResult = _Adjacent_find_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -6410,7 +6454,8 @@ namespace ranges { template , _Pj>, projected, _Pj>> _Pr = ranges::equal_to> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _Adjacent_find_unchecked(_Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); @@ -6486,8 +6531,8 @@ namespace ranges { template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr subrange<_It1> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, - _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr subrange<_It1> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, + _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First1, _Last1); _STD _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _RANGES _Unwrap_iter<_Se1>(_STD move(_First1)); @@ -6511,8 +6556,8 @@ namespace ranges { template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr borrowed_subrange_t<_Rng1> operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_subrange_t<_Rng1> operator()( + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) _CONST_CALL_OPERATOR { if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { const auto _Count1 = _RANGES distance(_Range1); const auto _Count2 = _RANGES distance(_Range2); @@ -6580,17 +6625,25 @@ 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? _Iterator_is_contiguous<_Iter> // The iterator must be contiguous so we can get raw pointers. && !_Iterator_is_volatile<_Iter> // The iterator must not be volatile. - && conjunction_v, is_pointer<_Elem>>, // Element is of integral or pointer type. + && conjunction_v, is_same<_Elem, double>, +#else // ^^^ 80-bit long double (not supported by MSVC in general, see GH-1316) / 64-bit long double vvv + is_floating_point<_Elem>, // Element is floating point or... +#endif // ^^^ 64-bit long double ^^^ +#endif // _USE_STD_VECTOR_FLOATING_ALGORITHMS + is_integral<_Elem>, is_pointer<_Elem>>, // ... 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 +6704,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) { @@ -6693,7 +6746,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); _STD _Seek_wrapped( _First, _RANGES _Max_element_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -6703,7 +6757,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _RANGES _Max_element_unchecked( _Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult)); @@ -6712,7 +6767,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 +6783,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? @@ -6740,8 +6795,8 @@ namespace ranges { public: template > _Pr = ranges::less> - _NODISCARD constexpr const _Ty& operator()( - const _Ty& _Left, const _Ty& _Right, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr const _Ty& operator()( + const _Ty& _Left, const _Ty& _Right, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if (_STD invoke(_Pred, _STD invoke(_Proj, _Left), _STD invoke(_Proj, _Right))) { return _Right; } else { @@ -6751,7 +6806,8 @@ namespace ranges { template > _Pr = ranges::less> - _NODISCARD constexpr _Ty operator()(initializer_list<_Ty> _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _Ty operator()( + initializer_list<_Ty> _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _First = _Range.begin(); const auto _Last = _Range.end(); _STL_ASSERT(_First != _Last, @@ -6762,7 +6818,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> requires indirectly_copyable_storable, range_value_t<_Rng>*> - _NODISCARD constexpr range_value_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr range_value_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UFirst = _Ubegin(_Range); auto _ULast = _Uend(_Range); _STL_ASSERT( @@ -6785,7 +6842,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 +6902,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) { @@ -6887,7 +6944,8 @@ namespace ranges { public: template _Se, class _Pj = identity, indirect_strict_weak_order> _Pr = ranges::less> - _NODISCARD constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _It operator()( + _It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { _STD _Adl_verify_range(_First, _Last); _STD _Seek_wrapped( _First, _RANGES _Min_element_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)), @@ -6897,7 +6955,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> - _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr borrowed_iterator_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UResult = _RANGES _Min_element_unchecked( _Ubegin(_Range), _Uend(_Range), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj)); return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult)); @@ -6906,7 +6965,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,14 +6981,14 @@ _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: template > _Pr = ranges::less> - _NODISCARD constexpr const _Ty& operator()( - const _Ty& _Left, const _Ty& _Right, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr const _Ty& operator()( + const _Ty& _Left, const _Ty& _Right, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { if (_STD invoke(_Pred, _STD invoke(_Proj, _Right), _STD invoke(_Proj, _Left))) { return _Right; } else { @@ -6939,7 +6998,8 @@ namespace ranges { template > _Pr = ranges::less> - _NODISCARD constexpr _Ty operator()(initializer_list<_Ty> _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr _Ty operator()( + initializer_list<_Ty> _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { const auto _First = _Range.begin(); const auto _Last = _Range.end(); _STL_ASSERT(_First != _Last, @@ -6950,7 +7010,8 @@ namespace ranges { template , _Pj>> _Pr = ranges::less> requires indirectly_copyable_storable, range_value_t<_Rng>*> - _NODISCARD constexpr range_value_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { + _NODISCARD _STATIC_CALL_OPERATOR constexpr range_value_t<_Rng> operator()( + _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) _CONST_CALL_OPERATOR { auto _UFirst = _Ubegin(_Range); auto _ULast = _Uend(_Range); _STL_ASSERT( @@ -6973,7 +7034,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 +7191,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 +7261,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/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 22e0936b1e5..8e1174da1d9 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -824,6 +824,7 @@ // warning: constexpr if is a C++17 extension [-Wc++17-extensions] // warning: explicit(bool) is a C++20 extension [-Wc++20-extensions] +// warning: declaring overloaded 'operator()' as 'static' is a C++23 extension [-Wc++23-extensions] // warning: ignoring __declspec(allocator) because the function return type '%s' is not a pointer or reference type // [-Wignored-attributes] // warning: '#pragma float_control' is not supported on this target - ignored [-Wignored-pragmas] @@ -836,6 +837,7 @@ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ _Pragma("clang diagnostic ignored \"-Wc++20-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++23-extensions\"") \ _Pragma("clang diagnostic ignored \"-Wignored-attributes\"") \ _Pragma("clang diagnostic ignored \"-Wignored-pragmas\"") \ _Pragma("clang diagnostic ignored \"-Wuser-defined-literals\"") \ @@ -884,7 +886,7 @@ #define _CPPLIB_VER 650 #define _MSVC_STL_VERSION 143 -#define _MSVC_STL_UPDATE 202401L +#define _MSVC_STL_UPDATE 202402L #ifndef _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH #if defined(__CUDACC__) && defined(__CUDACC_VER_MAJOR__) @@ -1717,72 +1719,53 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #endif // defined(__cpp_impl_coroutine) #if _HAS_CXX20 -#if !defined(__EDG__) || defined(__INTELLISENSE__) // TRANSITION, GH-395 -#if _HAS_CXX23 // TRANSITION, GH-395 - move down to "macros with language mode sensitivity" section -#define __cpp_lib_concepts 202207L // P2404R3 Move-Only Types For Comparison Concepts -#else // ^^^ C++23 / C++20 vvv -#define __cpp_lib_concepts 202002L // P1964R2 Replacing boolean With boolean-testable -#endif // C++20 -#endif // !defined(__EDG__) || defined(__INTELLISENSE__) - -#ifdef __cpp_lib_concepts #define __cpp_lib_algorithm_iterator_requirements 202207L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_assume_aligned 201811L -#define __cpp_lib_atomic_flag_test 201907L -#define __cpp_lib_atomic_float 201711L -#define __cpp_lib_atomic_lock_free_type_aliases 201907L -#define __cpp_lib_atomic_ref 201806L -#define __cpp_lib_atomic_shared_ptr 201711L -#define __cpp_lib_atomic_wait 201907L -#define __cpp_lib_barrier 202302L -#define __cpp_lib_bind_front 201907L -#define __cpp_lib_bit_cast 201806L -#define __cpp_lib_bitops 201907L -#define __cpp_lib_bounded_array_traits 201902L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_common_reference 202302L -#define __cpp_lib_common_reference_wrapper 202302L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_constexpr_algorithms 201806L -#define __cpp_lib_constexpr_complex 201711L -#define __cpp_lib_constexpr_dynamic_alloc 201907L -#define __cpp_lib_constexpr_functional 201907L -#define __cpp_lib_constexpr_iterator 201811L -#define __cpp_lib_constexpr_numeric 201911L -#define __cpp_lib_constexpr_string 201907L -#define __cpp_lib_constexpr_string_view 201811L -#define __cpp_lib_constexpr_tuple 201811L -#define __cpp_lib_constexpr_utility 201811L -#define __cpp_lib_constexpr_vector 201907L -#define __cpp_lib_destroying_delete 201806L -#define __cpp_lib_endian 201907L -#define __cpp_lib_erase_if 202002L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_format 202304L -#define __cpp_lib_format_uchar 202311L -#define __cpp_lib_freestanding_ranges 202306L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_generic_unordered_lookup 201811L -#define __cpp_lib_int_pow2 202002L -#define __cpp_lib_integer_comparison_functions 202002L -#define __cpp_lib_interpolate 201902L -#define __cpp_lib_is_constant_evaluated 201811L +#define __cpp_lib_assume_aligned 201811L +#define __cpp_lib_atomic_flag_test 201907L +#define __cpp_lib_atomic_float 201711L +#define __cpp_lib_atomic_lock_free_type_aliases 201907L +#define __cpp_lib_atomic_ref 201806L +#define __cpp_lib_atomic_shared_ptr 201711L +#define __cpp_lib_atomic_wait 201907L +#define __cpp_lib_barrier 202302L +#define __cpp_lib_bind_front 201907L +#define __cpp_lib_bit_cast 201806L +#define __cpp_lib_bitops 201907L +#define __cpp_lib_bounded_array_traits 201902L +#define __cpp_lib_common_reference 202302L +#define __cpp_lib_common_reference_wrapper 202302L +#define __cpp_lib_constexpr_algorithms 201806L +#define __cpp_lib_constexpr_complex 201711L +#define __cpp_lib_constexpr_dynamic_alloc 201907L +#define __cpp_lib_constexpr_functional 201907L +#define __cpp_lib_constexpr_iterator 201811L +#define __cpp_lib_constexpr_numeric 201911L +#define __cpp_lib_constexpr_string 201907L +#define __cpp_lib_constexpr_string_view 201811L +#define __cpp_lib_constexpr_tuple 201811L +#define __cpp_lib_constexpr_utility 201811L +#define __cpp_lib_constexpr_vector 201907L +#define __cpp_lib_destroying_delete 201806L +#define __cpp_lib_endian 201907L +#define __cpp_lib_erase_if 202002L +#define __cpp_lib_format 202304L +#define __cpp_lib_format_uchar 202311L +#define __cpp_lib_freestanding_ranges 202306L +#define __cpp_lib_generic_unordered_lookup 201811L +#define __cpp_lib_int_pow2 202002L +#define __cpp_lib_integer_comparison_functions 202002L +#define __cpp_lib_interpolate 201902L +#define __cpp_lib_is_constant_evaluated 201811L #ifndef __clang__ // TRANSITION, LLVM-48860 #define __cpp_lib_is_layout_compatible 201907L -#endif // !defined(__clang__) +#endif // ^^^ no workaround ^^^ #define __cpp_lib_is_nothrow_convertible 201806L #ifndef __clang__ // TRANSITION, LLVM-48860 #define __cpp_lib_is_pointer_interconvertible 201907L -#endif // !defined(__clang__) +#endif // ^^^ no workaround ^^^ #define __cpp_lib_jthread 201911L #define __cpp_lib_latch 201907L @@ -1791,12 +1774,9 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #if !defined(__clang__) && !defined(__EDG__) // TRANSITION, Clang and EDG support for modules #define __cpp_lib_modules 202207L -#endif // !defined(__clang__) && !defined(__EDG__) - -#ifdef __cpp_lib_concepts -#define __cpp_lib_move_iterator_concept 202207L -#endif // defined(__cpp_lib_concepts) +#endif // ^^^ no workaround ^^^ +#define __cpp_lib_move_iterator_concept 202207L #define __cpp_lib_polymorphic_allocator 201902L #define __cpp_lib_remove_cvref 201711L #define __cpp_lib_semaphore 201907L @@ -1806,15 +1786,11 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_ssize 201902L #define __cpp_lib_starts_ends_with 201711L #define __cpp_lib_syncbuf 201803L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_three_way_comparison 201907L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_to_address 201711L -#define __cpp_lib_to_array 201907L -#define __cpp_lib_type_identity 201806L -#define __cpp_lib_unwrap_ref 201811L +#define __cpp_lib_three_way_comparison 201907L +#define __cpp_lib_to_address 201711L +#define __cpp_lib_to_array 201907L +#define __cpp_lib_type_identity 201806L +#define __cpp_lib_unwrap_ref 201811L #endif // _HAS_CXX20 // C++23 @@ -1827,63 +1803,43 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_constexpr_bitset 202207L #define __cpp_lib_constexpr_charconv 202207L #define __cpp_lib_constexpr_typeinfo 202106L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_containers_ranges 202202L -#define __cpp_lib_expected 202211L -#define __cpp_lib_formatters 202302L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_forward_like 202207L - -#if defined(__cpp_lib_concepts) && defined(__cpp_lib_byte) && defined(__cpp_impl_coroutine) -#define __cpp_lib_generator 202207L -#endif // defined(__cpp_lib_concepts) && defined(__cpp_lib_byte) && defined(__cpp_impl_coroutine) - -#define __cpp_lib_invoke_r 202106L -#define __cpp_lib_ios_noreplace 202207L -#define __cpp_lib_is_scoped_enum 202011L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_mdspan 202207L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_move_only_function 202110L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_out_ptr 202106L -#define __cpp_lib_print 202207L -#define __cpp_lib_ranges_as_const 202311L -#define __cpp_lib_ranges_as_rvalue 202207L -#define __cpp_lib_ranges_cartesian_product 202207L -#define __cpp_lib_ranges_chunk 202202L -#define __cpp_lib_ranges_chunk_by 202202L -#define __cpp_lib_ranges_contains 202207L -#define __cpp_lib_ranges_enumerate 202302L -#define __cpp_lib_ranges_find_last 202207L -#define __cpp_lib_ranges_fold 202207L -#define __cpp_lib_ranges_iota 202202L -#define __cpp_lib_ranges_join_with 202202L -#define __cpp_lib_ranges_repeat 202207L -#define __cpp_lib_ranges_slide 202202L -#define __cpp_lib_ranges_starts_ends_with 202106L -#define __cpp_lib_ranges_stride 202207L -#define __cpp_lib_ranges_to_container 202202L -#define __cpp_lib_ranges_zip 202110L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_spanstream 202106L -#define __cpp_lib_stacktrace 202011L -#define __cpp_lib_stdatomic_h 202011L -#define __cpp_lib_string_contains 202011L -#define __cpp_lib_string_resize_and_overwrite 202110L -#define __cpp_lib_to_underlying 202102L - -#ifdef __cpp_lib_concepts -#define __cpp_lib_tuple_like 202207L -#endif // defined(__cpp_lib_concepts) - -#define __cpp_lib_unreachable 202202L +#define __cpp_lib_containers_ranges 202202L +#define __cpp_lib_expected 202211L +#define __cpp_lib_formatters 202302L +#define __cpp_lib_forward_like 202207L +#define __cpp_lib_generator 202207L +#define __cpp_lib_invoke_r 202106L +#define __cpp_lib_ios_noreplace 202207L +#define __cpp_lib_is_scoped_enum 202011L +#define __cpp_lib_mdspan 202207L +#define __cpp_lib_move_only_function 202110L +#define __cpp_lib_out_ptr 202106L +#define __cpp_lib_print 202207L +#define __cpp_lib_ranges_as_const 202311L +#define __cpp_lib_ranges_as_rvalue 202207L +#define __cpp_lib_ranges_cartesian_product 202207L +#define __cpp_lib_ranges_chunk 202202L +#define __cpp_lib_ranges_chunk_by 202202L +#define __cpp_lib_ranges_contains 202207L +#define __cpp_lib_ranges_enumerate 202302L +#define __cpp_lib_ranges_find_last 202207L +#define __cpp_lib_ranges_fold 202207L +#define __cpp_lib_ranges_iota 202202L +#define __cpp_lib_ranges_join_with 202202L +#define __cpp_lib_ranges_repeat 202207L +#define __cpp_lib_ranges_slide 202202L +#define __cpp_lib_ranges_starts_ends_with 202106L +#define __cpp_lib_ranges_stride 202207L +#define __cpp_lib_ranges_to_container 202202L +#define __cpp_lib_ranges_zip 202110L +#define __cpp_lib_spanstream 202106L +#define __cpp_lib_stacktrace 202011L +#define __cpp_lib_stdatomic_h 202011L +#define __cpp_lib_string_contains 202011L +#define __cpp_lib_string_resize_and_overwrite 202110L +#define __cpp_lib_to_underlying 202102L +#define __cpp_lib_tuple_like 202207L +#define __cpp_lib_unreachable 202202L #endif // _HAS_CXX23 // macros with language mode sensitivity @@ -1893,7 +1849,7 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_array_constexpr 201803L // P0858R0 Constexpr Iterator Requirements #endif // _HAS_CXX17 -#ifdef __cpp_lib_concepts +#if _HAS_CXX20 #define __cpp_lib_chrono 201907L // P1466R3 Miscellaneous Minor Fixes For #elif _HAS_CXX17 #define __cpp_lib_chrono 201611L // P0505R0 constexpr For (Again) @@ -1901,6 +1857,12 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_chrono 201510L // P0092R1 floor(), ceil(), round(), abs() #endif // ^^^ !_HAS_CXX17 ^^^ +#if _HAS_CXX23 +#define __cpp_lib_concepts 202207L // P2404R3 Move-Only Types For Comparison Concepts +#elif _HAS_CXX20 // ^^^ C++23 / C++20 vvv +#define __cpp_lib_concepts 202002L // P1964R2 Replacing boolean With boolean-testable +#endif // C++20 + #if _HAS_CXX23 #define __cpp_lib_constexpr_memory 202202L // P2273R3 constexpr unique_ptr #elif _HAS_CXX20 @@ -1915,7 +1877,7 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #endif // language mode #endif // !defined(_M_CEE_PURE) -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 #define __cpp_lib_optional 202110L // P0798R8 Monadic Operations For optional #elif _HAS_CXX20 // ^^^ _HAS_CXX23 / _HAS_CXX20 vvv #define __cpp_lib_optional 202106L // P2231R1 Completing constexpr In optional And variant @@ -1923,13 +1885,11 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_optional 201606L // P0307R2 Making Optional Greater Equal Again #endif // _HAS_CXX17 -#if defined(__cpp_lib_concepts) // TRANSITION, GH-395 #if _HAS_CXX23 #define __cpp_lib_ranges 202302L // P2609R3 Relaxing Ranges Just A Smidge #elif _HAS_CXX20 // ^^^ _HAS_CXX23 / _HAS_CXX20 vvv #define __cpp_lib_ranges 202110L // P2415R2 What Is A view? #endif // _HAS_CXX20 -#endif // defined(__cpp_lib_concepts) #if _HAS_CXX20 #define __cpp_lib_shared_ptr_arrays 201707L // P0674R1 make_shared() For Arrays @@ -1937,7 +1897,7 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_shared_ptr_arrays 201611L // P0497R0 Fixing shared_ptr For Arrays #endif -#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 +#if _HAS_CXX23 #define __cpp_lib_shift 202202L // P2440R1 ranges::shift_left, ranges::shift_right #elif _HAS_CXX20 // ^^^ _HAS_CXX23 / _HAS_CXX20 vvv #define __cpp_lib_shift 201806L // P0769R2 shift_left(), shift_right() @@ -2068,5 +2028,13 @@ compiler option, or define _ALLOW_RTCc_IN_STL to suppress this error. #define _STL_INTERNAL_STATIC_ASSERT(...) #endif // ^^^ !defined(_ENABLE_STL_INTERNAL_CHECK) ^^^ +#ifdef __cpp_static_call_operator +#define _STATIC_CALL_OPERATOR static +#define _CONST_CALL_OPERATOR +#else // ^^^ defined(__cpp_static_call_operator) / !defined(__cpp_static_call_operator) vvv +#define _STATIC_CALL_OPERATOR +#define _CONST_CALL_OPERATOR const +#endif // ^^^ !defined(__cpp_static_call_operator) ^^^ + #endif // _STL_COMPILER_PREPROCESSOR #endif // _YVALS_CORE_H_ diff --git a/stl/modules/std.ixx b/stl/modules/std.ixx index d81e0f556bf..30d960de720 100644 --- a/stl/modules/std.ixx +++ b/stl/modules/std.ixx @@ -66,7 +66,9 @@ export module std; #include #include #include +#if _HAS_CXX23 #include +#endif // _HAS_CXX23 #include #include #include diff --git a/stl/src/atomic_wait.cpp b/stl/src/atomic_wait.cpp index 123e8dcf57b..b45ed197403 100644 --- a/stl/src/atomic_wait.cpp +++ b/stl/src/atomic_wait.cpp @@ -410,7 +410,7 @@ _Smtx_t* __stdcall __std_atomic_get_mutex(const void* const _Key) noexcept { } return __std_atomic_compare_exchange_128_fallback(_Destination, _ExchangeHigh, _ExchangeLow, _ComparandResult); -#endif // ^^^ _STD_ATOMIC_ALWAYS_USE_CMPXCHG16B == 0 +#endif // ^^^ _STD_ATOMIC_ALWAYS_USE_CMPXCHG16B == 0 ^^^ } [[nodiscard]] char __stdcall __std_atomic_has_cmpxchg16b() noexcept { @@ -432,6 +432,6 @@ _Smtx_t* __stdcall __std_atomic_get_mutex(const void* const _Key) noexcept { } return _Value; -#endif // ^^^ _STD_ATOMIC_ALWAYS_USE_CMPXCHG16B == 0 +#endif // ^^^ _STD_ATOMIC_ALWAYS_USE_CMPXCHG16B == 0 ^^^ } } // extern "C" diff --git a/stl/src/vector_algorithms.cpp b/stl/src/vector_algorithms.cpp index 70a4e5b45aa..66f8895758f 100644 --- a/stl/src/vector_algorithms.cpp +++ b/stl/src/vector_algorithms.cpp @@ -545,6 +545,8 @@ namespace { }; struct _Minmax_traits_1 { + static constexpr bool _Is_floating = false; + using _Signed_t = int8_t; using _Unsigned_t = uint8_t; @@ -555,6 +557,10 @@ namespace { static constexpr bool _Has_portion_max = true; static constexpr size_t _Portion_max = 256; + static __m128i _Load(const void* _Src) noexcept { + return _mm_loadu_si128(reinterpret_cast(_Src)); + } + static __m128i _Sign_correction(const __m128i _Val, const bool _Sign) noexcept { alignas(16) static constexpr _Unsigned_t _Sign_corrections[2][16] = { {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, {}}; @@ -610,6 +616,10 @@ namespace { return _mm_cmpgt_epi8(_First, _Second); } + static __m128i _Cmp_eq_idx(const __m128i _First, const __m128i _Second) noexcept { + return _mm_cmpeq_epi8(_First, _Second); + } + static __m128i _Min(const __m128i _First, const __m128i _Second, __m128i) noexcept { return _mm_min_epi8(_First, _Second); } @@ -617,10 +627,16 @@ namespace { static __m128i _Max(const __m128i _First, const __m128i _Second, __m128i) noexcept { return _mm_max_epi8(_First, _Second); } + + static __m128i _Mask_cast(__m128i _Mask) noexcept { + return _Mask; + } #endif // !_M_ARM64EC }; struct _Minmax_traits_2 { + static constexpr bool _Is_floating = false; + using _Signed_t = int16_t; using _Unsigned_t = uint16_t; @@ -631,6 +647,10 @@ namespace { static constexpr bool _Has_portion_max = true; static constexpr size_t _Portion_max = 65536; + static __m128i _Load(const void* _Src) noexcept { + return _mm_loadu_si128(reinterpret_cast(_Src)); + } + static __m128i _Sign_correction(const __m128i _Val, const bool _Sign) noexcept { alignas(16) static constexpr _Unsigned_t _Sign_corrections[2][8] = { 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, {}}; @@ -687,6 +707,10 @@ namespace { return _mm_cmpgt_epi16(_First, _Second); } + static __m128i _Cmp_eq_idx(const __m128i _First, const __m128i _Second) noexcept { + return _mm_cmpeq_epi16(_First, _Second); + } + static __m128i _Min(const __m128i _First, const __m128i _Second, __m128i) noexcept { return _mm_min_epi16(_First, _Second); } @@ -694,10 +718,16 @@ namespace { static __m128i _Max(const __m128i _First, const __m128i _Second, __m128i) noexcept { return _mm_max_epi16(_First, _Second); } + + static __m128i _Mask_cast(__m128i _Mask) noexcept { + return _Mask; + } #endif // !_M_ARM64EC }; struct _Minmax_traits_4 { + static constexpr bool _Is_floating = false; + using _Signed_t = int32_t; using _Unsigned_t = uint32_t; @@ -712,6 +742,10 @@ namespace { static constexpr size_t _Portion_max = 0x1'0000'0000ULL; #endif // ^^^ 64-bit ^^^ + static __m128i _Load(const void* _Src) noexcept { + return _mm_loadu_si128(reinterpret_cast(_Src)); + } + static __m128i _Sign_correction(const __m128i _Val, const bool _Sign) noexcept { alignas(16) static constexpr _Unsigned_t _Sign_corrections[2][4] = { 0x8000'0000UL, 0x8000'0000UL, 0x8000'0000UL, 0x8000'0000UL, {}}; @@ -764,6 +798,10 @@ namespace { return _mm_cmpgt_epi32(_First, _Second); } + static __m128i _Cmp_eq_idx(const __m128i _First, const __m128i _Second) noexcept { + return _mm_cmpeq_epi32(_First, _Second); + } + static __m128i _Min(const __m128i _First, const __m128i _Second, __m128i) noexcept { return _mm_min_epi32(_First, _Second); } @@ -771,10 +809,16 @@ namespace { static __m128i _Max(const __m128i _First, const __m128i _Second, __m128i) noexcept { return _mm_max_epi32(_First, _Second); } + + static __m128i _Mask_cast(__m128i _Mask) noexcept { + return _Mask; + } #endif // !_M_ARM64EC }; struct _Minmax_traits_8 { + static constexpr bool _Is_floating = false; + using _Signed_t = int64_t; using _Unsigned_t = uint64_t; @@ -784,6 +828,10 @@ namespace { #ifndef _M_ARM64EC static constexpr bool _Has_portion_max = false; + static __m128i _Load(const void* _Src) noexcept { + return _mm_loadu_si128(reinterpret_cast(_Src)); + } + static __m128i _Sign_correction(const __m128i _Val, const bool _Sign) noexcept { alignas(16) static constexpr _Unsigned_t _Sign_corrections[2][2] = { 0x8000'0000'0000'0000ULL, 0x8000'0000'0000'0000ULL, {}}; @@ -844,6 +892,10 @@ namespace { return _mm_cmpgt_epi64(_First, _Second); } + static __m128i _Cmp_eq_idx(const __m128i _First, const __m128i _Second) noexcept { + return _mm_cmpeq_epi64(_First, _Second); + } + static __m128i _Min(const __m128i _First, const __m128i _Second, const __m128i _Mask) noexcept { return _mm_blendv_epi8(_First, _Second, _Mask); } @@ -851,6 +903,206 @@ namespace { static __m128i _Max(const __m128i _First, const __m128i _Second, const __m128i _Mask) noexcept { return _mm_blendv_epi8(_First, _Second, _Mask); } + + static __m128i _Mask_cast(__m128i _Mask) noexcept { + return _Mask; + } +#endif // !_M_ARM64EC + }; + + struct _Minmax_traits_f { + static constexpr bool _Is_floating = true; + + using _Signed_t = float; + + static constexpr _Signed_t _Init_min_val = __builtin_huge_valf(); + static constexpr _Signed_t _Init_max_val = -__builtin_huge_valf(); + +#ifndef _M_ARM64EC +#ifdef _M_IX86 + static constexpr bool _Has_portion_max = false; +#else // ^^^ 32-bit / 64-bit vvv + static constexpr bool _Has_portion_max = true; + static constexpr size_t _Portion_max = 0x1'0000'0000ULL; +#endif // ^^^ 64-bit ^^^ + + static __m128 _Load(const void* _Src) noexcept { + return _mm_loadu_ps(reinterpret_cast(_Src)); + } + + static __m128 _Sign_correction(const __m128 _Val, bool) noexcept { + return _Val; + } + + static __m128i _Inc(__m128i _Idx) noexcept { + return _mm_add_epi32(_Idx, _mm_set1_epi32(1)); + } + + template + static __m128 _H_func(const __m128 _Cur, _Fn _Funct) noexcept { + __m128 _H_min_val = _Cur; + _H_min_val = _Funct(_H_min_val, _mm_shuffle_ps(_H_min_val, _H_min_val, _MM_SHUFFLE(1, 0, 3, 2))); + _H_min_val = _Funct(_H_min_val, _mm_shuffle_ps(_H_min_val, _H_min_val, _MM_SHUFFLE(2, 3, 0, 1))); + return _H_min_val; + } + + template + static __m128i _H_func_u(const __m128i _Cur, _Fn _Funct) noexcept { + __m128i _H_min_val = _Cur; + _H_min_val = _Funct(_H_min_val, _mm_shuffle_epi32(_H_min_val, _MM_SHUFFLE(1, 0, 3, 2))); + _H_min_val = _Funct(_H_min_val, _mm_shuffle_epi32(_H_min_val, _MM_SHUFFLE(2, 3, 0, 1))); + return _H_min_val; + } + + static __m128 _H_min(const __m128 _Cur) noexcept { + return _H_func(_Cur, [](__m128 _First, __m128 _Second) { return _mm_min_ps(_First, _Second); }); + } + + static __m128 _H_max(const __m128 _Cur) noexcept { + return _H_func(_Cur, [](__m128 _First, __m128 _Second) { return _mm_max_ps(_First, _Second); }); + } + + static __m128i _H_min_u(const __m128i _Cur) noexcept { + return _H_func_u(_Cur, [](__m128i _First, __m128i _Second) { return _mm_min_epu32(_First, _Second); }); + } + + static __m128i _H_max_u(const __m128i _Cur) noexcept { + return _H_func_u(_Cur, [](__m128i _First, __m128i _Second) { return _mm_max_epu32(_First, _Second); }); + } + + static float _Get_any(const __m128 _Cur) noexcept { + return _mm_cvtss_f32(_Cur); + } + + static uint32_t _Get_v_pos(const __m128i _Idx, const unsigned long _H_pos) noexcept { + uint32_t _Array[4]; + _mm_storeu_si128(reinterpret_cast<__m128i*>(&_Array), _Idx); + return _Array[_H_pos >> 2]; + } + + static __m128 _Cmp_eq(const __m128 _First, const __m128 _Second) noexcept { + return _mm_cmpeq_ps(_First, _Second); + } + + static __m128 _Cmp_gt(const __m128 _First, const __m128 _Second) noexcept { + return _mm_cmpgt_ps(_First, _Second); + } + + static __m128i _Cmp_eq_idx(const __m128i _First, const __m128i _Second) noexcept { + return _mm_cmpeq_epi32(_First, _Second); + } + + static __m128 _Min(const __m128 _First, const __m128 _Second, __m128) noexcept { + return _mm_min_ps(_First, _Second); + } + + static __m128 _Max(const __m128 _First, const __m128 _Second, __m128) noexcept { + return _mm_max_ps(_First, _Second); + } + + static __m128i _Mask_cast(__m128 _Mask) noexcept { + return _mm_castps_si128(_Mask); + } +#endif // !_M_ARM64EC + }; + + struct _Minmax_traits_d { + static constexpr bool _Is_floating = true; + + using _Signed_t = double; + + static constexpr _Signed_t _Init_min_val = __builtin_huge_val(); + static constexpr _Signed_t _Init_max_val = -__builtin_huge_val(); + +#ifndef _M_ARM64EC + static constexpr bool _Has_portion_max = false; + + static __m128d _Load(const void* _Src) noexcept { + return _mm_loadu_pd(reinterpret_cast(_Src)); + } + + static __m128d _Sign_correction(const __m128d _Val, bool) noexcept { + return _Val; + } + + static __m128i _Inc(__m128i _Idx) noexcept { + return _mm_add_epi64(_Idx, _mm_set1_epi64x(1)); + } + + template + static __m128d _H_func(const __m128d _Cur, _Fn _Funct) noexcept { + __m128d _H_min_val = _Cur; + _H_min_val = _Funct(_H_min_val, _mm_shuffle_pd(_H_min_val, _H_min_val, 1)); + return _H_min_val; + } + + template + static __m128i _H_func_u(const __m128i _Cur, _Fn _Funct) noexcept { + uint64_t _H_min_a = _Get_any_u(_Cur); + uint64_t _H_min_b = _Get_any_u(_mm_bsrli_si128(_Cur, 8)); + if (_Funct(_H_min_b, _H_min_a)) { + _H_min_a = _H_min_b; + } + return _mm_set1_epi64x(_H_min_a); + } + + static __m128d _H_min(const __m128d _Cur) noexcept { + return _H_func(_Cur, [](__m128d _First, __m128d _Second) { return _mm_min_pd(_First, _Second); }); + } + + static __m128d _H_max(const __m128d _Cur) noexcept { + return _H_func(_Cur, [](__m128d _First, __m128d _Second) { return _mm_max_pd(_First, _Second); }); + } + + static __m128i _H_min_u(const __m128i _Cur) noexcept { + return _H_func_u(_Cur, [](uint64_t _Lhs, uint64_t _Rhs) { return _Lhs < _Rhs; }); + } + + static __m128i _H_max_u(const __m128i _Cur) noexcept { + return _H_func_u(_Cur, [](uint64_t _Lhs, uint64_t _Rhs) { return _Lhs > _Rhs; }); + } + static double _Get_any(const __m128d _Cur) noexcept { + return _mm_cvtsd_f64(_Cur); + } + + static uint64_t _Get_any_u(const __m128i _Cur) noexcept { +#ifdef _M_IX86 + return (static_cast(static_cast(_mm_extract_epi32(_Cur, 1))) << 32) + | static_cast(static_cast(_mm_cvtsi128_si32(_Cur))); +#else // ^^^ x86 / x64 vvv + return static_cast(_mm_cvtsi128_si64(_Cur)); +#endif // ^^^ x64 ^^^ + } + + static uint64_t _Get_v_pos(const __m128i _Idx, const unsigned long _H_pos) noexcept { + uint64_t _Array[2]; + _mm_storeu_si128(reinterpret_cast<__m128i*>(&_Array), _Idx); + return _Array[_H_pos >> 3]; + } + + static __m128d _Cmp_eq(const __m128d _First, const __m128d _Second) noexcept { + return _mm_cmpeq_pd(_First, _Second); + } + + static __m128d _Cmp_gt(const __m128d _First, const __m128d _Second) noexcept { + return _mm_cmpgt_pd(_First, _Second); + } + + static __m128i _Cmp_eq_idx(const __m128i _First, const __m128i _Second) noexcept { + return _mm_cmpeq_epi64(_First, _Second); + } + + static __m128d _Min(const __m128d _First, const __m128d _Second, __m128d) noexcept { + return _mm_min_pd(_First, _Second); + } + + static __m128d _Max(const __m128d _First, const __m128d _Second, __m128d) noexcept { + return _mm_max_pd(_First, _Second); + } + + static __m128i _Mask_cast(__m128d _Mask) noexcept { + return _mm_castpd_si128(_Mask); + } #endif // !_M_ARM64EC }; @@ -882,13 +1134,12 @@ namespace { _Advance_bytes(_Stop_at, _Portion_byte_size); // Load values and if unsigned adjust them to be signed (for signed vector comparisons) - __m128i _Cur_vals = - _Traits::_Sign_correction(_mm_loadu_si128(reinterpret_cast(_First)), _Sign); - __m128i _Cur_vals_min = _Cur_vals; // vector of vertical minimum values - __m128i _Cur_idx_min = _mm_setzero_si128(); // vector of vertical minimum indices - __m128i _Cur_vals_max = _Cur_vals; // vector of vertical maximum values - __m128i _Cur_idx_max = _mm_setzero_si128(); // vector of vertical maximum indices - __m128i _Cur_idx = _mm_setzero_si128(); // current vector of indices + auto _Cur_vals = _Traits::_Sign_correction(_Traits::_Load(_First), _Sign); + auto _Cur_vals_min = _Cur_vals; // vector of vertical minimum values + auto _Cur_idx_min = _mm_setzero_si128(); // vector of vertical minimum indices + auto _Cur_vals_max = _Cur_vals; // vector of vertical maximum values + auto _Cur_idx_max = _mm_setzero_si128(); // vector of vertical maximum indices + auto _Cur_idx = _mm_setzero_si128(); // current vector of indices for (;;) { _Advance_bytes(_First, 16); @@ -901,21 +1152,21 @@ namespace { // Compute horizontal min and/or max. Determine horizontal and vertical position of it. if constexpr ((_Mode & _Mode_min) != 0) { - const __m128i _H_min = - _Traits::_H_min(_Cur_vals_min); // Vector populated by the smallest element + const auto _H_min = _Traits::_H_min(_Cur_vals_min); // Vector populated by the smallest element const auto _H_min_val = _Traits::_Get_any(_H_min); // Get any element of it if (_H_min_val < _Cur_min_val) { // Current horizontal min is less than the old _Cur_min_val = _H_min_val; // update min - const __m128i _Eq_mask = + const auto _Eq_mask = _Traits::_Cmp_eq(_H_min, _Cur_vals_min); // Mask of all elems eq to min - int _Mask = _mm_movemask_epi8(_Eq_mask); + int _Mask = _mm_movemask_epi8(_Traits::_Mask_cast(_Eq_mask)); // Indices of minimum elements or the greatest index if none - const __m128i _All_max = _mm_set1_epi8(static_cast(0xFF)); - const __m128i _Idx_min_val = _mm_blendv_epi8(_All_max, _Cur_idx_min, _Eq_mask); - __m128i _Idx_min = _Traits::_H_min_u(_Idx_min_val); // The smallest indices + const auto _All_max = _mm_set1_epi8(static_cast(0xFF)); + const auto _Idx_min_val = + _mm_blendv_epi8(_All_max, _Cur_idx_min, _Traits::_Mask_cast(_Eq_mask)); + auto _Idx_min = _Traits::_H_min_u(_Idx_min_val); // The smallest indices // Select the smallest vertical indices from the smallest element mask - _Mask &= _mm_movemask_epi8(_Traits::_Cmp_eq(_Idx_min, _Idx_min_val)); + _Mask &= _mm_movemask_epi8(_Traits::_Cmp_eq_idx(_Idx_min, _Idx_min_val)); unsigned long _H_pos; // Find the smallest horizontal index @@ -928,8 +1179,7 @@ namespace { } if constexpr ((_Mode & _Mode_max) != 0) { - const __m128i _H_max = - _Traits::_H_max(_Cur_vals_max); // Vector populated by the largest element + const auto _H_max = _Traits::_H_max(_Cur_vals_max); // Vector populated by the largest element const auto _H_max_val = _Traits::_Get_any(_H_max); // Get any element of it if (_Mode == _Mode_both && _Cur_max_val <= _H_max_val @@ -937,19 +1187,19 @@ namespace { // max_element: current horizontal max is greater than the old, update max // minmax_element: current horizontal max is not less than the old, update max _Cur_max_val = _H_max_val; - const __m128i _Eq_mask = + const auto _Eq_mask = _Traits::_Cmp_eq(_H_max, _Cur_vals_max); // Mask of all elems eq to max - int _Mask = _mm_movemask_epi8(_Eq_mask); + int _Mask = _mm_movemask_epi8(_Traits::_Mask_cast(_Eq_mask)); unsigned long _H_pos; if constexpr (_Mode == _Mode_both) { // Looking for the last occurrence of maximum // Indices of maximum elements or zero if none - const __m128i _Idx_max_val = - _mm_blendv_epi8(_mm_setzero_si128(), _Cur_idx_max, _Eq_mask); - const __m128i _Idx_max = _Traits::_H_max_u(_Idx_max_val); // The greatest indices + const auto _Idx_max_val = + _mm_blendv_epi8(_mm_setzero_si128(), _Cur_idx_max, _Traits::_Mask_cast(_Eq_mask)); + const auto _Idx_max = _Traits::_H_max_u(_Idx_max_val); // The greatest indices // Select the greatest vertical indices from the largest element mask - _Mask &= _mm_movemask_epi8(_Traits::_Cmp_eq(_Idx_max, _Idx_max_val)); + _Mask &= _mm_movemask_epi8(_Traits::_Cmp_eq_idx(_Idx_max, _Idx_max_val)); // Find the largest horizontal index _BitScanReverse(&_H_pos, _Mask); // lgtm [cpp/conditionallyuninitializedvariable] @@ -958,11 +1208,12 @@ namespace { } else { // Looking for the first occurrence of maximum // Indices of maximum elements or the greatest index if none - const __m128i _All_max = _mm_set1_epi8(static_cast(0xFF)); - const __m128i _Idx_max_val = _mm_blendv_epi8(_All_max, _Cur_idx_max, _Eq_mask); - const __m128i _Idx_max = _Traits::_H_min_u(_Idx_max_val); // The smallest indices + const auto _All_max = _mm_set1_epi8(static_cast(0xFF)); + const auto _Idx_max_val = + _mm_blendv_epi8(_All_max, _Cur_idx_max, _Traits::_Mask_cast(_Eq_mask)); + const auto _Idx_max = _Traits::_H_min_u(_Idx_max_val); // The smallest indices // Select the smallest vertical indices from the largest element mask - _Mask &= _mm_movemask_epi8(_Traits::_Cmp_eq(_Idx_max, _Idx_max_val)); + _Mask &= _mm_movemask_epi8(_Traits::_Cmp_eq_idx(_Idx_max, _Idx_max_val)); // Find the smallest horizontal index _BitScanForward(&_H_pos, _Mask); // lgtm [cpp/conditionallyuninitializedvariable] @@ -991,8 +1242,7 @@ namespace { // Indices will be relative to the new base _Base = static_cast(_First); // Load values and if unsigned adjust them to be signed (for signed vector comparisons) - _Cur_vals = - _Traits::_Sign_correction(_mm_loadu_si128(reinterpret_cast(_First)), _Sign); + _Cur_vals = _Traits::_Sign_correction(_Traits::_Load(_First), _Sign); if constexpr ((_Mode & _Mode_min) != 0) { _Cur_vals_min = _Cur_vals; @@ -1012,55 +1262,67 @@ namespace { // This is the main part, finding vertical minimum/maximum // Load values and if unsigned adjust them to be signed (for signed vector comparisons) - _Cur_vals = _Traits::_Sign_correction(_mm_loadu_si128(reinterpret_cast(_First)), _Sign); + _Cur_vals = _Traits::_Sign_correction(_Traits::_Load(_First), _Sign); if constexpr ((_Mode & _Mode_min) != 0) { // Looking for the first occurrence of minimum, don't overwrite with newly found occurrences - const __m128i _Is_less = _Traits::_Cmp_gt(_Cur_vals_min, _Cur_vals); // _Cur_vals < _Cur_vals_min - _Cur_idx_min = _mm_blendv_epi8(_Cur_idx_min, _Cur_idx, _Is_less); // Remember their vertical indices + const auto _Is_less = _Traits::_Cmp_gt(_Cur_vals_min, _Cur_vals); // _Cur_vals < _Cur_vals_min + _Cur_idx_min = _mm_blendv_epi8( + _Cur_idx_min, _Cur_idx, _Traits::_Mask_cast(_Is_less)); // Remember their vertical indices _Cur_vals_min = _Traits::_Min(_Cur_vals_min, _Cur_vals, _Is_less); // Update the current minimum } if constexpr (_Mode == _Mode_max) { // Looking for the first occurrence of maximum, don't overwrite with newly found occurrences - const __m128i _Is_greater = _Traits::_Cmp_gt(_Cur_vals, _Cur_vals_max); // _Cur_vals > _Cur_vals_max - _Cur_idx_max = - _mm_blendv_epi8(_Cur_idx_max, _Cur_idx, _Is_greater); // Remember their vertical indices + const auto _Is_greater = _Traits::_Cmp_gt(_Cur_vals, _Cur_vals_max); // _Cur_vals > _Cur_vals_max + _Cur_idx_max = _mm_blendv_epi8( + _Cur_idx_max, _Cur_idx, _Traits::_Mask_cast(_Is_greater)); // Remember their vertical indices _Cur_vals_max = _Traits::_Max(_Cur_vals_max, _Cur_vals, _Is_greater); // Update the current maximum } else if constexpr (_Mode == _Mode_both) { // Looking for the last occurrence of maximum, do overwrite with newly found occurrences - const __m128i _Is_less = - _Traits::_Cmp_gt(_Cur_vals_max, _Cur_vals); // !(_Cur_vals >= _Cur_vals_max) - _Cur_idx_max = _mm_blendv_epi8(_Cur_idx, _Cur_idx_max, _Is_less); // Remember their vertical indices + const auto _Is_less = _Traits::_Cmp_gt(_Cur_vals_max, _Cur_vals); // !(_Cur_vals >= _Cur_vals_max) + _Cur_idx_max = _mm_blendv_epi8(_Cur_idx, _Cur_idx_max, + _Traits::_Mask_cast(_Is_less)); // Remember their vertical indices _Cur_vals_max = _Traits::_Max(_Cur_vals, _Cur_vals_max, _Is_less); // Update the current maximum } } } #endif // !_M_ARM64EC - using _STy = _Traits::_Signed_t; - using _UTy = _Traits::_Unsigned_t; - - constexpr _UTy _Correction = _UTy{1} << (sizeof(_UTy) * 8 - 1); - if constexpr (_Mode == _Mode_min) { - if (_Sign) { - return _Min_tail(_First, _Last, _Res._Min, static_cast<_STy>(_Cur_min_val)); + if constexpr (_Traits::_Is_floating) { + if constexpr (_Mode == _Mode_min) { + return _Min_tail(_First, _Last, _Res._Min, _Cur_min_val); + } else if constexpr (_Mode == _Mode_max) { + return _Max_tail(_First, _Last, _Res._Max, _Cur_max_val); } else { - return _Min_tail(_First, _Last, _Res._Min, static_cast<_UTy>(_Cur_min_val + _Correction)); - } - } else if constexpr (_Mode == _Mode_max) { - if (_Sign) { - return _Max_tail(_First, _Last, _Res._Max, static_cast<_STy>(_Cur_max_val)); - } else { - return _Max_tail(_First, _Last, _Res._Max, static_cast<_UTy>(_Cur_max_val + _Correction)); + return _Both_tail(_First, _Last, _Res, _Cur_min_val, _Cur_max_val); } } else { - if (_Sign) { - return _Both_tail( - _First, _Last, _Res, static_cast<_STy>(_Cur_min_val), static_cast<_STy>(_Cur_max_val)); + using _STy = _Traits::_Signed_t; + using _UTy = _Traits::_Unsigned_t; + + constexpr _UTy _Correction = _UTy{1} << (sizeof(_UTy) * 8 - 1); + + if constexpr (_Mode == _Mode_min) { + if (_Sign) { + return _Min_tail(_First, _Last, _Res._Min, static_cast<_STy>(_Cur_min_val)); + } else { + return _Min_tail(_First, _Last, _Res._Min, static_cast<_UTy>(_Cur_min_val + _Correction)); + } + } else if constexpr (_Mode == _Mode_max) { + if (_Sign) { + return _Max_tail(_First, _Last, _Res._Max, static_cast<_STy>(_Cur_max_val)); + } else { + return _Max_tail(_First, _Last, _Res._Max, static_cast<_UTy>(_Cur_max_val + _Correction)); + } } else { - return _Both_tail(_First, _Last, _Res, static_cast<_UTy>(_Cur_min_val + _Correction), - static_cast<_UTy>(_Cur_max_val + _Correction)); + if (_Sign) { + return _Both_tail( + _First, _Last, _Res, static_cast<_STy>(_Cur_min_val), static_cast<_STy>(_Cur_max_val)); + } else { + return _Both_tail(_First, _Last, _Res, static_cast<_UTy>(_Cur_min_val + _Correction), + static_cast<_UTy>(_Cur_max_val + _Correction)); + } } } } @@ -1089,6 +1351,16 @@ const void* __stdcall __std_min_element_8( return _Minmax_element<_Mode_min, _Minmax_traits_8>(_First, _Last, _Signed); } +const void* __stdcall __std_min_element_f( + const void* const _First, const void* const _Last, const bool _Unused) noexcept { + return _Minmax_element<_Mode_min, _Minmax_traits_f>(_First, _Last, _Unused); +} + +const void* __stdcall __std_min_element_d( + const void* const _First, const void* const _Last, const bool _Unused) noexcept { + return _Minmax_element<_Mode_min, _Minmax_traits_d>(_First, _Last, _Unused); +} + const void* __stdcall __std_max_element_1( const void* const _First, const void* const _Last, const bool _Signed) noexcept { return _Minmax_element<_Mode_max, _Minmax_traits_1>(_First, _Last, _Signed); @@ -1109,6 +1381,16 @@ const void* __stdcall __std_max_element_8( return _Minmax_element<_Mode_max, _Minmax_traits_8>(_First, _Last, _Signed); } +const void* __stdcall __std_max_element_f( + const void* const _First, const void* const _Last, const bool _Unused) noexcept { + return _Minmax_element<_Mode_max, _Minmax_traits_f>(_First, _Last, _Unused); +} + +const void* __stdcall __std_max_element_d( + const void* const _First, const void* const _Last, const bool _Unused) noexcept { + return _Minmax_element<_Mode_max, _Minmax_traits_d>(_First, _Last, _Unused); +} + _Min_max_element_t __stdcall __std_minmax_element_1( const void* const _First, const void* const _Last, const bool _Signed) noexcept { return _Minmax_element<_Mode_both, _Minmax_traits_1>(_First, _Last, _Signed); @@ -1129,6 +1411,15 @@ _Min_max_element_t __stdcall __std_minmax_element_8( return _Minmax_element<_Mode_both, _Minmax_traits_8>(_First, _Last, _Signed); } +_Min_max_element_t __stdcall __std_minmax_element_f( + const void* const _First, const void* const _Last, const bool _Unused) noexcept { + return _Minmax_element<_Mode_both, _Minmax_traits_f>(_First, _Last, _Unused); +} + +_Min_max_element_t __stdcall __std_minmax_element_d( + const void* const _First, const void* const _Last, const bool _Unused) noexcept { + return _Minmax_element<_Mode_both, _Minmax_traits_d>(_First, _Last, _Unused); +} } // extern "C" namespace { diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 4b413af66aa..35906ff455a 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -184,9 +184,17 @@ std/modules/std.pass.cpp FAIL # *** ASAN FAILURES *** # Even with `allocator_may_return_null=1`, ASan kills oversized allocations instead of throwing `bad_alloc`. # (https://github.com/google/sanitizers/issues/295) +std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align_nothrow.except.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.except.pass.cpp:1 FAIL std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.array/new.size_nothrow.except.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.array/new.size.except.pass.cpp:1 FAIL std/language.support/support.dynamic/new.delete/new.delete.array/new.size.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.except.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.except.pass.cpp:1 FAIL std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.single/new.size_nothrow.except.pass.cpp:1 FAIL +std/language.support/support.dynamic/new.delete/new.delete.single/new.size.except.pass.cpp:1 FAIL std/language.support/support.dynamic/new.delete/new.delete.single/new.size.pass.cpp:1 FAIL std/strings/basic.string/string.capacity/max_size.pass.cpp:1 FAIL @@ -435,6 +443,10 @@ std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_wit std/containers/sequences/array/array.cons/initialization.pass.cpp:0 FAIL std/containers/sequences/array/array.cons/initialization.pass.cpp:1 FAIL +# DevCom-10456523: MSVC incorrectly raises constant evaluation failure in pointer comparison +std/algorithms/robust_against_adl.compile.pass.cpp:0 FAIL +std/algorithms/robust_against_adl.compile.pass.cpp:1 FAIL + # VSO-1923988: constexpr evaluation performs an assignment with a derived type when it should use a base type std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp:0 FAIL std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp:1 FAIL @@ -535,9 +547,6 @@ std/language.support/cmp/cmp.alg/partial_order.pass.cpp FAIL std/language.support/cmp/cmp.alg/strong_order.pass.cpp FAIL std/language.support/cmp/cmp.alg/weak_order.pass.cpp FAIL -# GH-1596: : unqualified calls to _Adl_verify_range incorrectly cause instantiation -std/algorithms/robust_against_adl.compile.pass.cpp FAIL - # GH-3100: etc.: ADL should be avoided when calling _Construct_in_place and its friends std/utilities/function.objects/func.wrap/func.wrap.func/robust_against_adl.pass.cpp FAIL diff --git a/tests/std/include/test_atomic_wait.hpp b/tests/std/include/test_atomic_wait.hpp index 9322cd5454a..2999cb57100 100644 --- a/tests/std/include/test_atomic_wait.hpp +++ b/tests/std/include/test_atomic_wait.hpp @@ -291,5 +291,5 @@ inline void test_atomic_wait() { test_pad_bits>(waiting_duration); test_pad_bits>(waiting_duration); #endif // ^^^ !ARM ^^^ -#endif // __clang__, TRANSITION, LLVM-46685 +#endif // ^^^ no workaround ^^^ } diff --git a/tests/std/include/test_min_max_element_support.hpp b/tests/std/include/test_min_max_element_support.hpp index 2d764b3dbf0..9ade4d6b898 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 a1f8f5b611f..a84ae56e1d6 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_0000000_tuple_cat/test.cpp b/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp index 4258b875f6d..78a23775861 100644 --- a/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp +++ b/tests/std/tests/Dev11_0000000_tuple_cat/test.cpp @@ -10,12 +10,12 @@ #include #include -#ifdef __cpp_lib_ranges +#if _HAS_CXX20 #include #include #include #include -#endif // __cpp_lib_ranges +#endif // _HAS_CXX20 using namespace std; @@ -231,7 +231,7 @@ int main() { } } -#ifdef __cpp_lib_ranges +#if _HAS_CXX20 { using ranges::subrange, ranges::subrange_kind; @@ -252,7 +252,7 @@ int main() { STATIC_ASSERT(is_same_v>); assert(cat7 == make_tuple(next(lst.begin()), prev(lst.end()), vec.begin() + 1, vec.cend() - 1)); } -#endif // __cpp_lib_ranges +#endif // _HAS_CXX20 // Also test C++17 apply() and make_from_tuple(). #if _HAS_CXX17 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 44927210742..377d783dd34 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_0235721_async_and_packaged_task/test.cpp b/tests/std/tests/Dev11_0235721_async_and_packaged_task/test.cpp index 95bb8f044e6..e4672fe3ed0 100644 --- a/tests/std/tests/Dev11_0235721_async_and_packaged_task/test.cpp +++ b/tests/std/tests/Dev11_0235721_async_and_packaged_task/test.cpp @@ -354,7 +354,7 @@ struct use_async_in_a_global_tester { }; use_async_in_a_global_tester use_async_in_a_global_instance; -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ int main() { test_DevDiv_235721(); 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 28af703f5db..5ec9aaf9445 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/Dev11_0535636_functional_overhaul/test.cpp b/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp index c5ea48f6893..492030269dc 100644 --- a/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp +++ b/tests/std/tests/Dev11_0535636_functional_overhaul/test.cpp @@ -1395,7 +1395,7 @@ _CONSTEXPR20 bool test_mem_fn() { assert(mem_fn(&Widget::unary_lv)(&w, 6) == 1061); assert(mem_fn(&Widget::unary_rv)(move(w), 7) == 1404); -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ return true; } 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 003d16eadae..70c5665ca46 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 +#endif // ^^^ no workaround ^^^ 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 9b7cf5ab6e1..fe0b36682a4 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 9bd78f6bb3f..00c835d9ad1 100644 --- a/tests/std/tests/GH_000431_equal_family/test.cpp +++ b/tests/std/tests/GH_000431_equal_family/test.cpp @@ -661,7 +661,7 @@ void test_algorithms(EqualFn equal_fn) { assert(!equal_fn(begin(arr6), end(arr6), begin(arr7), end(arr7), equal_to<>{})); assert(!equal_fn(begin(arr6), end(arr6), begin(arr7), end(arr7), equal_to{})); } -#endif // _M_CEE_PURE +#endif // ^^^ no workaround ^^^ { // Test vector vector arr1 = {3, 6, 4, 7, 3}; @@ -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 560f081613f..efbe45e9f59 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 e82adc5789f..cac035a3e90 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 ee47a0f7bbb..b8017b70fee 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 2d0e1b77179..94d1542a686 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 fc4c9fd515d..d98a62588f5 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_000545_include_compare/test_stacktrace.cpp b/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp index 3439aa43c43..c6088a978ce 100644 --- a/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp +++ b/tests/std/tests/GH_000545_include_compare/test_stacktrace.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#ifdef __cpp_lib_stacktrace +#if _HAS_CXX23 #include @@ -10,6 +10,6 @@ static_assert(std::is_eq(std::partial_ordering::equivalent)); -#endif // __cpp_lib_stacktrace +#endif // _HAS_CXX23 void test_stacktrace() {} diff --git a/tests/std/tests/GH_000690_overaligned_function/test.cpp b/tests/std/tests/GH_000690_overaligned_function/test.cpp index 573c14cf762..c94cd1b8783 100644 --- a/tests/std/tests/GH_000690_overaligned_function/test.cpp +++ b/tests/std/tests/GH_000690_overaligned_function/test.cpp @@ -64,7 +64,7 @@ void test() { int main() { test>(); -#ifdef __cpp_lib_move_only_function +#if _HAS_CXX23 test>(); #endif } diff --git a/tests/std/tests/GH_000940_missing_valarray_copy/test.cpp b/tests/std/tests/GH_000940_missing_valarray_copy/test.cpp index 0bbddc0e17b..d8d6189b82d 100644 --- a/tests/std/tests/GH_000940_missing_valarray_copy/test.cpp +++ b/tests/std/tests/GH_000940_missing_valarray_copy/test.cpp @@ -115,7 +115,7 @@ int main() { #if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10416247 STATIC_ASSERT(std::is_nothrow_default_constructible_v); // strengthened -#endif // defined(__clang__) || defined(__EDG__) +#endif // ^^^ no workaround ^^^ std::gslice gs{}; STATIC_ASSERT(noexcept(gs.start())); // strengthened } diff --git a/tests/std/tests/GH_001411_core_headers/test.cpp b/tests/std/tests/GH_001411_core_headers/test.cpp index 1bf1d87f6c6..6f962ddcd02 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 @@ -51,11 +51,11 @@ void test_gh_2699() { assert(cats[1] == 50); assert(dogs[1] == 20); -#ifdef __cpp_lib_ranges +#if _HAS_CXX20 std::ranges::swap(cats, dogs); assert(cats[1] == 20); assert(dogs[1] == 50); -#endif // __cpp_lib_ranges +#endif // _HAS_CXX20 } int main() { 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 12a478f4185..e4d1e2fc036 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 @@ -34,6 +34,15 @@ struct tagged_less { } }; +template +struct tagged_zero_equality { + template + constexpr auto operator()(T&& t) const + -> decltype(std::forward(t) == std::remove_cv_t>{}) { + return std::forward(t) == std::remove_cv_t>{}; + } +}; + #if _HAS_CXX20 template struct tagged_compare_three_way { @@ -89,6 +98,7 @@ struct incomplete; using simple_truth = tagged_truth; using simple_identity = tagged_identity; using simple_left_selector = tagged_left_selector; +using simple_zero_equality = tagged_zero_equality; using simple_urng = tagged_urng; using validator = holder*; @@ -97,6 +107,7 @@ using validating_equal = tagged_equal>; using validating_less = tagged_less>; using validating_identity = tagged_identity>; using validating_left_selector = tagged_left_selector>; +using validating_zero_equality = tagged_zero_equality>; using validating_urng = tagged_urng>; #if _HAS_CXX20 @@ -253,7 +264,7 @@ void test_algorithms() { #endif // _HAS_CXX17 // std::shuffle(varr, varr, simple_urng{}); // requires Cpp17ValueSwappable - // std::shuffle(iarr, iarr, validating_urng{}); // requires Cpp17ValueSwappable + std::shuffle(iarr, iarr, validating_urng{}); // std::random_shuffle (removed in C++17) also requires Cpp17ValueSwappable @@ -263,9 +274,60 @@ void test_algorithms() { // (void) std::shift_right(varr, varr, 0); // requires Cpp17ValueSwappable #endif // _HAS_CXX20 + // std::sort(varr, varr); // requires Cpp17ValueSwappable + std::sort(iarr, iarr, validating_less{}); + + // std::stable_sort(varr, varr); // requires Cpp17ValueSwappable + std::stable_sort(iarr, iarr, validating_less{}); + + std::partial_sort(varr, varr, varr); // requires Cpp17ValueSwappable + std::partial_sort(iarr, iarr, iarr, validating_less{}); + + void* vparr[1]{}; + + (void) std::partial_sort_copy(varr, varr, varr2, varr2); // requires Cpp17ValueSwappable + (void) std::partial_sort_copy(varr, varr, vparr, vparr); + (void) std::partial_sort_copy(iarr, iarr, iarr2, iarr2, validating_less{}); + + (void) std::is_sorted(varr, varr); + (void) std::is_sorted(iarr, iarr, validating_less{}); + + (void) std::is_sorted_until(varr, varr); + (void) std::is_sorted_until(iarr, iarr, validating_less{}); + + // std::nth_element(varr, varr, varr); // requires Cpp17ValueSwappable + std::nth_element(iarr, iarr, iarr, validating_less{}); + + (void) std::lower_bound(varr, varr, validator{}); + (void) std::lower_bound(iarr, iarr, 0, validating_less{}); + + (void) std::upper_bound(varr, varr, validator{}); + (void) std::upper_bound(iarr, iarr, 0, validating_less{}); + + (void) std::equal_range(varr, varr, validator{}); + (void) std::equal_range(iarr, iarr, 0, validating_less{}); + + (void) std::binary_search(varr, varr, validator{}); + (void) std::binary_search(iarr, iarr, 0, validating_less{}); + + (void) std::is_partitioned(varr, varr, simple_zero_equality{}); + (void) std::is_partitioned(iarr, iarr, validating_zero_equality{}); + + // (void) std::partition(varr, varr, simple_zero_equality{}); // requires Cpp17ValueSwappable + (void) std::partition(iarr, iarr, validating_zero_equality{}); + + // (void) std::stable_partition(varr, varr, simple_zero_equality{}); // requires Cpp17ValueSwappable + (void) std::stable_partition(iarr, iarr, validating_zero_equality{}); + int iarr3[1]{}; validator varr3[1]{}; + (void) std::partition_copy(varr, varr, varr2, varr3, simple_zero_equality{}); + (void) std::partition_copy(iarr, iarr, iarr2, iarr3, validating_zero_equality{}); + + (void) std::partition_point(varr, varr, simple_zero_equality{}); + (void) std::partition_point(iarr, iarr, validating_zero_equality{}); + (void) std::merge(varr, varr, varr2, varr2, varr3); (void) std::merge(iarr, iarr, iarr2, iarr2, iarr3, validating_less{}); @@ -337,10 +399,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{}); @@ -479,9 +541,46 @@ void test_per_execution_policy() { // (void) std::shift_right(ExecutionPolicy, varr, varr, 0); // requires Cpp17ValueSwappable #endif // _HAS_CXX20 + // std::sort(ExecutionPolicy, varr, varr); // requires Cpp17ValueSwappable + std::sort(ExecutionPolicy, iarr, iarr, validating_less{}); + + // std::stable_sort(ExecutionPolicy, varr, varr); // requires Cpp17ValueSwappable + std::stable_sort(ExecutionPolicy, iarr, iarr, validating_less{}); + + std::partial_sort(ExecutionPolicy, varr, varr, varr); // requires Cpp17ValueSwappable + std::partial_sort(ExecutionPolicy, iarr, iarr, iarr, validating_less{}); + + void* vparr[1]{}; + + (void) std::partial_sort_copy(ExecutionPolicy, varr, varr, varr2, varr2); // requires Cpp17ValueSwappable + (void) std::partial_sort_copy(ExecutionPolicy, varr, varr, vparr, vparr); + (void) std::partial_sort_copy(ExecutionPolicy, iarr, iarr, iarr2, iarr2, validating_less{}); + + (void) std::is_sorted(ExecutionPolicy, varr, varr); + (void) std::is_sorted(ExecutionPolicy, iarr, iarr, validating_less{}); + + (void) std::is_sorted_until(ExecutionPolicy, varr, varr); + (void) std::is_sorted_until(ExecutionPolicy, iarr, iarr, validating_less{}); + + // std::nth_element(ExecutionPolicy, varr, varr, varr); // requires Cpp17ValueSwappable + std::nth_element(ExecutionPolicy, iarr, iarr, iarr, validating_less{}); + + (void) std::is_partitioned(ExecutionPolicy, varr, varr, simple_zero_equality{}); + (void) std::is_partitioned(ExecutionPolicy, iarr, iarr, validating_zero_equality{}); + + // (void) std::partition(ExecutionPolicy, varr, varr, simple_zero_equality{}); // requires Cpp17ValueSwappable + (void) std::partition(ExecutionPolicy, iarr, iarr, validating_zero_equality{}); + + // (void) std::stable_partition( + // ExecutionPolicy, varr, varr, simple_zero_equality{}); // requires Cpp17ValueSwappable + (void) std::stable_partition(ExecutionPolicy, iarr, iarr, validating_zero_equality{}); + int iarr3[2]{}; validator varr3[2]{}; + (void) std::partition_copy(ExecutionPolicy, varr, varr, varr2, varr3, simple_zero_equality{}); + (void) std::partition_copy(ExecutionPolicy, iarr, iarr, iarr2, iarr3, validating_zero_equality{}); + (void) std::merge(ExecutionPolicy, varr, varr, varr2, varr2, varr3); (void) std::merge(ExecutionPolicy, iarr, iarr, iarr2, iarr2, iarr3, validating_less{}); @@ -532,7 +631,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 +730,5 @@ void test_ranges_non_projected_algorithms() { (void) shift_right(varr, 0); #endif // _HAS_CXX23 } -#endif // _HAS_CXX20 && defined(__cpp_lib_concepts) -#endif // _M_CEE +#endif // _HAS_CXX20 +#endif // ^^^ no workaround ^^^ diff --git a/tests/std/tests/GH_001914_cached_position/env.lst b/tests/std/tests/GH_001914_cached_position/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/GH_001914_cached_position/env.lst +++ b/tests/std/tests/GH_001914_cached_position/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst 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 bf788feb2fd..5d869884177 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 { @@ -1852,7 +1850,7 @@ void run_tests() { test_sstream(); #if !(defined(__clang__) && defined(_M_IX86)) // TRANSITION, LLVM-54804 test_exceptions(); -#endif // !(defined(__clang__) && defined(_M_IX86)) +#endif // ^^^ no workaround ^^^ } template class Alloc> diff --git a/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp b/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp index d2a5f1e7676..93ac83e275b 100644 --- a/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp +++ b/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp @@ -1019,8 +1019,7 @@ int main() { run_allocator_matrix(); run_allocator_matrix(); -// TRANSITION, LLVM-35365 -#ifndef __clang__ +#ifndef __clang__ // TRANSITION, LLVM-35365 test_push_back_throw(); test_emplace_back_throw(); test_insert_range_throw(); @@ -1028,6 +1027,6 @@ int main() { test_emplace_throw(); test_resize_throw(); test_insert_n_throw(); -#endif // !__clang__ +#endif // ^^^ no workaround ^^^ #endif // ASan instrumentation enabled } diff --git a/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/env.lst b/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/env.lst index 269bb574bcf..e05d343051d 100644 --- a/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/env.lst +++ b/tests/std/tests/GH_002431_byte_range_find_with_unreachable_sentinel/env.lst @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst RUNALL_CROSSLIST * PM_CL="" * PM_CL="/D_USE_STD_VECTOR_ALGORITHMS=0" diff --git a/tests/std/tests/GH_002488_promise_not_default_constructible_types/test.cpp b/tests/std/tests/GH_002488_promise_not_default_constructible_types/test.cpp index 1aafc7bfa90..51b5f20438e 100644 --- a/tests/std/tests/GH_002488_promise_not_default_constructible_types/test.cpp +++ b/tests/std/tests/GH_002488_promise_not_default_constructible_types/test.cpp @@ -156,7 +156,7 @@ void run_tests() { assert(failures == 7); assert(succeeded != -1 && f.get().x == succeeded); } -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ { (void) std::async(std::launch::async, [] { return T(16); }); diff --git a/tests/std/tests/GH_002558_format_presetPadding/env.lst b/tests/std/tests/GH_002558_format_presetPadding/env.lst index 0e31b4c2875..5fda65fe1ff 100644 --- a/tests/std/tests/GH_002558_format_presetPadding/env.lst +++ b/tests/std/tests/GH_002558_format_presetPadding/env.lst @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# This is concepts_20_matrix.lst + /presetPadding with clang configs disabled (clang-cl doesn't support /presetPadding) +# This is usual_20_matrix.lst + /presetPadding with clang configs disabled (clang-cl doesn't support /presetPadding) RUNALL_INCLUDE ..\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit- /presetPadding" @@ -34,7 +34,7 @@ PM_CL="/EHsc /MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive- /analyze ASAN PM_CL="/EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/clr /MD /std:c++20" PM_CL="/clr /MDd /std:c++20" -# PM_CL="/std:c++20 /permissive- /BE /c /EHsc /MD" -# PM_CL="/std:c++latest /permissive- /BE /c /EHsc /MTd" +PM_CL="/std:c++20 /permissive- /BE /c /EHsc /MD" +PM_CL="/std:c++latest /permissive- /BE /c /EHsc /MTd" # PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /std:c++20 /permissive- /MD" # PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /std:c++latest /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/GH_002581_common_reference_workaround/env.lst b/tests/std/tests/GH_002581_common_reference_workaround/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/GH_002581_common_reference_workaround/env.lst +++ b/tests/std/tests/GH_002581_common_reference_workaround/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/GH_002620_construct_at_workaround/test.cpp b/tests/std/tests/GH_002620_construct_at_workaround/test.cpp index 2b90c2d13ba..8ccab2f5193 100644 --- a/tests/std/tests/GH_002620_construct_at_workaround/test.cpp +++ b/tests/std/tests/GH_002620_construct_at_workaround/test.cpp @@ -29,5 +29,5 @@ int main() { // GH-2620: : SFINAE constraint on construct_at prevents emplacing immovable objects with copy elision #ifndef __EDG__ // TRANSITION, DevCom-10000388 construct_at(&u.s, copy_elider{}); -#endif // TRANSITION, DevCom-10000388 +#endif // ^^^ no workaround ^^^ } 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 34fde2bafc5..1d71a44c9e1 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 00444b29231..f7f002e56fb 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_002992_unwrappable_iter_sent_pairs/env.lst b/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/env.lst +++ b/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/GH_003003_format_decimal_point/env.lst b/tests/std/tests/GH_003003_format_decimal_point/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/GH_003003_format_decimal_point/env.lst +++ b/tests/std/tests/GH_003003_format_decimal_point/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/GH_003022_substr_allocator/test.cpp b/tests/std/tests/GH_003022_substr_allocator/test.cpp index d6d26b36370..3ea2b0b0cbb 100644 --- a/tests/std/tests/GH_003022_substr_allocator/test.cpp +++ b/tests/std/tests/GH_003022_substr_allocator/test.cpp @@ -174,11 +174,13 @@ CONSTEXPR20 bool test_substr_allocator() { } }; -#if _HAS_CXX23 && !defined(__EDG__) // TRANSITION, VSO-1601179 +#if _HAS_CXX23 +#ifndef __EDG__ // TRANSITION, VSO-1601179 static_assert(!is_constructible_v, "This should be ambiguous"); -#else // _HAS_CXX23 && !defined(__EDG__) +#endif // ^^^ no workaround ^^^ +#else // ^^^ _HAS_CXX23 / !_HAS_CXX23 vvv static_assert(is_constructible_v, "This should be unambiguous"); -#endif // _HAS_CXX23 && !defined(__EDG__) +#endif // ^^^ !_HAS_CXX23 ^^^ return true; } diff --git a/tests/std/tests/GH_003676_format_large_hh_mm_ss_values/env.lst b/tests/std/tests/GH_003676_format_large_hh_mm_ss_values/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/GH_003676_format_large_hh_mm_ss_values/env.lst +++ b/tests/std/tests/GH_003676_format_large_hh_mm_ss_values/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/env.lst b/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/env.lst +++ b/tests/std/tests/GH_004023_mdspan_fwd_prod_overflow/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst 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 25c53023fa0..1ec2c22408d 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 08520f59bf5..99a3593c6a9 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/GH_004201_chrono_formatter/env.lst b/tests/std/tests/GH_004201_chrono_formatter/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/GH_004201_chrono_formatter/env.lst +++ b/tests/std/tests/GH_004201_chrono_formatter/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/LWG3480_directory_iterator_range/env.lst b/tests/std/tests/LWG3480_directory_iterator_range/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/LWG3480_directory_iterator_range/env.lst +++ b/tests/std/tests/LWG3480_directory_iterator_range/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/LWG3610_iota_view_size_and_integer_class/env.lst b/tests/std/tests/LWG3610_iota_view_size_and_integer_class/env.lst index d6d824b5879..351a8293d9d 100644 --- a/tests/std/tests/LWG3610_iota_view_size_and_integer_class/env.lst +++ b/tests/std/tests/LWG3610_iota_view_size_and_integer_class/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_default_accessor/env.lst b/tests/std/tests/P0009R18_mdspan_default_accessor/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_default_accessor/env.lst +++ b/tests/std/tests/P0009R18_mdspan_default_accessor/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_default_accessor/test.cpp b/tests/std/tests/P0009R18_mdspan_default_accessor/test.cpp index aa0e829edb2..e2efe8de0b6 100644 --- a/tests/std/tests/P0009R18_mdspan_default_accessor/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_default_accessor/test.cpp @@ -69,6 +69,8 @@ constexpr bool test() { } int main() { +#if !(defined(_DEBUG) && defined(__EDG__)) // TRANSITION, VSO-1898962 static_assert(test()); +#endif // ^^^ no workaround ^^^ test(); } diff --git a/tests/std/tests/P0009R18_mdspan_extents/env.lst b/tests/std/tests/P0009R18_mdspan_extents/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_extents/env.lst +++ b/tests/std/tests/P0009R18_mdspan_extents/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_extents_death/env.lst b/tests/std/tests/P0009R18_mdspan_extents_death/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_extents_death/env.lst +++ b/tests/std/tests/P0009R18_mdspan_extents_death/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_layout_left/env.lst b/tests/std/tests/P0009R18_mdspan_layout_left/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_left/env.lst +++ b/tests/std/tests/P0009R18_mdspan_layout_left/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_layout_left_death/env.lst b/tests/std/tests/P0009R18_mdspan_layout_left_death/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_left_death/env.lst +++ b/tests/std/tests/P0009R18_mdspan_layout_left_death/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_layout_right/env.lst b/tests/std/tests/P0009R18_mdspan_layout_right/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_right/env.lst +++ b/tests/std/tests/P0009R18_mdspan_layout_right/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_layout_right_death/env.lst b/tests/std/tests/P0009R18_mdspan_layout_right_death/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_right_death/env.lst +++ b/tests/std/tests/P0009R18_mdspan_layout_right_death/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_layout_stride/env.lst b/tests/std/tests/P0009R18_mdspan_layout_stride/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_stride/env.lst +++ b/tests/std/tests/P0009R18_mdspan_layout_stride/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_layout_stride_death/env.lst b/tests/std/tests/P0009R18_mdspan_layout_stride_death/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_stride_death/env.lst +++ b/tests/std/tests/P0009R18_mdspan_layout_stride_death/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_mdspan/env.lst b/tests/std/tests/P0009R18_mdspan_mdspan/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_mdspan/env.lst +++ b/tests/std/tests/P0009R18_mdspan_mdspan/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0009R18_mdspan_mdspan_death/env.lst b/tests/std/tests/P0009R18_mdspan_mdspan_death/env.lst index 18e2d7c71ec..642f530ffad 100644 --- a/tests/std/tests/P0009R18_mdspan_mdspan_death/env.lst +++ b/tests/std/tests/P0009R18_mdspan_mdspan_death/env.lst @@ -1,4 +1,4 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_latest_matrix.lst +RUNALL_INCLUDE ..\usual_latest_matrix.lst diff --git a/tests/std/tests/P0019R8_atomic_ref/test.cpp b/tests/std/tests/P0019R8_atomic_ref/test.cpp index a5aee42c08d..c5ecce949ed 100644 --- a/tests/std/tests/P0019R8_atomic_ref/test.cpp +++ b/tests/std/tests/P0019R8_atomic_ref/test.cpp @@ -371,7 +371,7 @@ void test_incomplete_associated_class_all() { // COMPILE-ONLY test_incomplete_associated_class>*>(); test_incomplete_associated_class>*>(); } -#endif // !defined(_M_CEE) +#endif // ^^^ no workaround ^^^ int main() { test_ops(); diff --git a/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp b/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp index e43e22a6538..5d1c50b6056 100644 --- a/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp +++ b/tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp @@ -158,7 +158,7 @@ void test_node_handle(NodeHandle& nh1, NodeHandle& nh2, Validator1 v1, Validator #pragma warning(suppress : 4640) // C4640 emitted by MSVC because 'NodeHandle' type has non-trivial dtor { static constinit NodeHandle static_handle{}; } #endif // ^^^ _HAS_CXX20 ^^^ -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ // No copies! static_assert(!std::is_copy_constructible_v); diff --git a/tests/std/tests/P0122R7_span/test.cpp b/tests/std/tests/P0122R7_span/test.cpp index 176df595bda..a3d47462b1d 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 9d760fe8ed2..853936a6646 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 bda8ed79438..f6db52ddb21 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/P0323R12_expected/test.cpp b/tests/std/tests/P0323R12_expected/test.cpp index 82a748e357c..381e49bfa1c 100644 --- a/tests/std/tests/P0323R12_expected/test.cpp +++ b/tests/std/tests/P0323R12_expected/test.cpp @@ -201,6 +201,7 @@ namespace test_expected { template constexpr void test_default_constructors() { +#ifndef __EDG__ // TRANSITION, VSO-1898929 constexpr bool should_be_defaultable = IsYes(defaultConstructible); struct payload_default_constructor { @@ -225,11 +226,13 @@ namespace test_expected { assert(defaulted); assert(defaulted.value() == 42); } +#endif // ^^^ no workaround ^^^ } template constexpr void test_copy_constructors() { +#ifndef __EDG__ // TRANSITION, VSO-1898929 constexpr bool should_be_trivial = IsYes(triviallyCopyConstructible); constexpr bool should_be_noexcept = should_be_trivial || IsYes(nothrowCopyConstructible); @@ -300,6 +303,7 @@ namespace test_expected { assert(from_error.error() == (should_be_trivial ? 0 : 42)); static_assert(noexcept(Expected{with_error}) == should_be_noexcept); } +#endif // ^^^ no workaround ^^^ { // ensure we are not copy constructible if either the payload or the error are not struct not_copy_constructible { @@ -315,6 +319,7 @@ namespace test_expected { template constexpr void test_move_constructors() { +#ifndef __EDG__ // TRANSITION, VSO-1898929 constexpr bool should_be_trivial = IsYes(triviallyMoveConstructible); constexpr bool should_be_noexcept = should_be_trivial || IsYes(nothrowMoveConstructible); @@ -386,6 +391,7 @@ namespace test_expected { assert(from_error.error() == (should_be_trivial ? 0 : 42)); static_assert(noexcept(Expected{move(error_input)}) == should_be_noexcept); } +#endif // ^^^ no workaround ^^^ { // ensure we are not move constructible if either the payload or the error are not struct not_move_constructible { @@ -1347,9 +1353,13 @@ namespace test_expected { test_triviality_of_assignment(); test_triviality_of_assignment(); test_triviality_of_assignment(); +#ifndef __EDG__ // TRANSITION, VSO-1949451 test_triviality_of_assignment(); +#endif // ^^^ no workaround ^^^ test_triviality_of_assignment(); +#ifndef __EDG__ // TRANSITION, VSO-1949451 test_triviality_of_assignment(); +#endif // ^^^ no workaround ^^^ } constexpr void test_emplace() noexcept { diff --git a/tests/std/tests/P0325R4_to_array/test.cpp b/tests/std/tests/P0325R4_to_array/test.cpp index adf4c3ae531..79c0a02f6d9 100644 --- a/tests/std/tests/P0325R4_to_array/test.cpp +++ b/tests/std/tests/P0325R4_to_array/test.cpp @@ -66,7 +66,7 @@ void test_adl_proof() { // COMPILE-ONLY (void) std::to_array(a); // intentionally qualified to avoid ADL (void) std::to_array(std::move(a)); // intentionally qualified to avoid ADL } -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ int main() { assert(assert_constexpr()); diff --git a/tests/std/tests/P0339R6_polymorphic_allocator/test.cpp b/tests/std/tests/P0339R6_polymorphic_allocator/test.cpp index 0245ba354bd..4d62371bc4c 100644 --- a/tests/std/tests/P0339R6_polymorphic_allocator/test.cpp +++ b/tests/std/tests/P0339R6_polymorphic_allocator/test.cpp @@ -77,7 +77,7 @@ void allocate_object_overflow_test() { } catch (...) { assert(false); } -#endif // TRANSITION, VSO-1854243 +#endif // ^^^ no workaround ^^^ try { [[maybe_unused]] int* vp = alloc.allocate_object(threshold + 1); 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 9ed77e4bca7..a0b24b0b320 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_formatting/env.lst b/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/env.lst index 223468e5254..6fef53fd62d 100644 --- a/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/env.lst +++ b/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/env.lst @@ -1,6 +1,6 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -RUNALL_INCLUDE ..\concepts_20_matrix.lst +RUNALL_INCLUDE ..\usual_20_matrix.lst RUNALL_CROSSLIST * PM_CL="/utf-8" 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 a55118c262d..dc509bea954 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 12c1cd395c0..d8ce3cb83cf 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/P0415R1_constexpr_complex/test.cpp b/tests/std/tests/P0415R1_constexpr_complex/test.cpp index b750a2ea5ad..5ba0fb1fa99 100644 --- a/tests/std/tests/P0415R1_constexpr_complex/test.cpp +++ b/tests/std/tests/P0415R1_constexpr_complex/test.cpp @@ -63,7 +63,7 @@ constexpr void test_type() { c /= complex{f1, f3}; #ifndef _M_CEE // TRANSITION, VSO-1665481 assert(c == complex{f1}); -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ { using Other = conditional_t, double, float>; @@ -83,7 +83,7 @@ constexpr void test_type() { c /= complex{Other{1}, Other{3}}; #ifndef _M_CEE // TRANSITION, VSO-1665481 assert(c == complex{f1}); -#endif // _M_CEE +#endif // ^^^ no workaround ^^^ } assert((complex{f1, f1} + complex{f1, f2} == complex{f2, f3})); diff --git a/tests/std/tests/P0433R2_deduction_guides/test.cpp b/tests/std/tests/P0433R2_deduction_guides/test.cpp index e943019850d..02de419f829 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