Skip to content

Conversation

StephanTLavavej
Copy link
Member

This removes redundant _HAS_CXX23 guards around _Compile_time_max_size specializations, for views that are already guarded for C++23.

Note that these changes are very low risk because the primary template for _Compile_time_max_size is guarded for C++23. If we attempted to specialize it in C++20 mode, we'd get instant errors:

STL/stl/inc/ranges

Lines 44 to 55 in e36ee6c

#if _HAS_CXX23
_EXPORT_STD template <range _Rng>
using const_iterator_t = decltype(_RANGES cbegin(_STD declval<_Rng&>()));
_EXPORT_STD template <range _Rng>
using const_sentinel_t = decltype(_RANGES cend(_STD declval<_Rng&>()));
_EXPORT_STD template <range _Rng>
using range_const_reference_t = iter_const_reference_t<iterator_t<_Rng>>;
template <range _Ty>
constexpr auto _Compile_time_max_size = (numeric_limits<_Make_unsigned_like_t<range_difference_t<_Ty>>>::max)();

This also adds a couple of #endif comments; they aren't strictly necessary but they helped me ripgrep for the redundant guards.

Noticed while reviewing #4707.

…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.
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jun 11, 2024
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner June 11, 2024 12:27
@StephanTLavavej StephanTLavavej added the ranges C++20/23 ranges label Jun 11, 2024
@StephanTLavavej
Copy link
Member Author

I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit b483591 into microsoft:main Jun 18, 2024
@StephanTLavavej StephanTLavavej deleted the cxx23-ranges branch June 18, 2024 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved ranges C++20/23 ranges
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants