From 1227bb6cf70998b13274e892f395523fe29a3024 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 11 Jun 2024 04:40:14 -0700 Subject: [PATCH 1/2] Add `#endif` comments. --- stl/inc/ranges | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index d93eb0bfc83..69e8cf744d4 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -3134,7 +3134,7 @@ namespace ranges { #if _HAS_CXX23 } else if constexpr (!sized_range<_Rng> && _Strat == _St::_Reconstruct_repeat_view) { return repeat_view(_STD forward_like<_Rng>(*_Range._Value), _Count); -#endif +#endif // _HAS_CXX23 } else { // it's a "reconstructible range"; return the same kind of range with a restricted extent _Count = (_STD min)(_RANGES distance(_Range), _Count); @@ -3150,7 +3150,7 @@ namespace ranges { #if _HAS_CXX23 } else if constexpr (_Strat == _St::_Reconstruct_repeat_view) { return repeat_view(_STD forward_like<_Rng>(*_Range._Value), _Count); -#endif +#endif // _HAS_CXX23 } else if constexpr (_Strat == _St::_Reconstruct_subrange) { return subrange(_First, _First + _Count); } else { From 58553aca1fc9a150ef3507a0d40b6836459f415a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 11 Jun 2024 04:57:13 -0700 Subject: [PATCH 2/2] Remove redundant `_HAS_CXX23` guards around `_Compile_time_max_size` specializations. These views are already guarded for C++23. Note that the primary template for `_Compile_time_max_size` is guarded by `_HAS_CXX23`, so these changes aren't risky - if we attempted to define specializations in C++20 mode, we'd get instant errors. --- stl/inc/ranges | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 69e8cf744d4..b3485e3fd7e 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -2135,13 +2135,11 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Rng>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; template constexpr auto _Compile_time_max_size> = _Compile_time_max_size; -#endif // _HAS_CXX23 namespace views { template @@ -4576,7 +4574,6 @@ namespace ranges { join_with_view(_Rng&&, range_value_t>) -> join_with_view, single_view>>>; -#if _HAS_CXX23 template _NODISCARD consteval auto _Join_with_view_compile_time_max_size() { using _Inner = remove_reference_t>; @@ -4605,7 +4602,6 @@ namespace ranges { template constexpr auto _Compile_time_max_size> = _Join_with_view_compile_time_max_size(); -#endif // _HAS_CXX23 namespace views { struct _Join_with_fn { @@ -5638,13 +5634,11 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Rng>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; template constexpr auto _Compile_time_max_size> = _Compile_time_max_size; -#endif // _HAS_CXX23 namespace views { template @@ -6455,13 +6449,11 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Rng>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; template constexpr auto _Compile_time_max_size> = _Compile_time_max_size; -#endif // _HAS_CXX23 namespace views { class _Enumerate_fn : public _Pipe::_Base<_Enumerate_fn> { @@ -7054,14 +7046,12 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Vw> && forward_range<_Vw>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; template requires forward_range<_Rng> constexpr auto _Compile_time_max_size> = _Compile_time_max_size; -#endif // _HAS_CXX23 namespace views { struct _Chunk_fn { @@ -7454,13 +7444,11 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Vw>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; template constexpr auto _Compile_time_max_size> = _Compile_time_max_size; -#endif // _HAS_CXX23 namespace views { struct _Slide_fn { @@ -7660,10 +7648,8 @@ namespace ranges { template chunk_by_view(_Rng&&, _Pr) -> chunk_by_view, _Pr>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; -#endif // _HAS_CXX23 namespace views { struct _Chunk_by_fn { @@ -8052,13 +8038,11 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Vw>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size<_Rng>; template constexpr auto _Compile_time_max_size> = _Compile_time_max_size; -#endif // _HAS_CXX23 namespace views { struct _Stride_fn { @@ -8558,7 +8542,6 @@ namespace ranges { template constexpr bool enable_borrowed_range> = (enable_borrowed_range<_ViewTypes> && ...); -#if _HAS_CXX23 template _NODISCARD consteval auto _Zip_view_compile_time_max_size() { using _Size_type = common_type_t)...>; @@ -8570,7 +8553,6 @@ namespace ranges { template constexpr auto _Compile_time_max_size> = _Zip_view_compile_time_max_size(); -#endif // _HAS_CXX23 namespace views { struct _Zip_fn { @@ -8910,7 +8892,6 @@ namespace ranges { template zip_transform_view(_Func, _Ranges&&...) -> zip_transform_view<_Func, views::all_t<_Ranges>...>; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size>; @@ -8918,7 +8899,6 @@ namespace ranges { template constexpr auto _Compile_time_max_size> = _Compile_time_max_size>; -#endif // _HAS_CXX23 namespace views { struct _Zip_transform_fn { @@ -9374,7 +9354,6 @@ namespace ranges { template constexpr bool enable_borrowed_range> = enable_borrowed_range<_Rng>; -#if _HAS_CXX23 template _NODISCARD consteval auto _Adjacent_view_compile_time_max_size() { using _Size_type = common_type_t), size_t>; @@ -9389,7 +9368,6 @@ namespace ranges { template constexpr auto _Compile_time_max_size> = _Adjacent_view_compile_time_max_size(); -#endif // _HAS_CXX23 namespace views { template @@ -9726,7 +9704,6 @@ namespace ranges { } }; -#if _HAS_CXX23 template constexpr auto _Compile_time_max_size> = _Compile_time_max_size>; @@ -9734,7 +9711,6 @@ namespace ranges { template constexpr auto _Compile_time_max_size> = _Compile_time_max_size>; -#endif // _HAS_CXX23 namespace views { template @@ -10255,7 +10231,6 @@ namespace ranges { template cartesian_product_view(_Rngs&&...) -> cartesian_product_view...>; -#if _HAS_CXX23 template _NODISCARD consteval auto _Cartesian_product_view_compile_time_max_size() { using _Size_type = common_type_t()), @@ -10277,7 +10252,6 @@ namespace ranges { template constexpr auto _Compile_time_max_size> = _Cartesian_product_view_compile_time_max_size(); -#endif // _HAS_CXX23 namespace views { class _Cartesian_product_fn {