From a51e22a9e6c661fa6ed45eed18fc454f0dfb155d Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Fri, 5 Aug 2022 14:01:22 +0200 Subject: [PATCH] Apply more suggestions from code review * Rename `_Iterator_base` to `_Category_base` * Swap `stride_view` constraints * Fix `stride_view`'s iterator cross comparisons in tests (`ci <=> ci2` -> `i <=> ci2`) --- stl/inc/ranges | 10 +++++----- tests/std/tests/P1899R3_views_stride/test.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 771bf629b46..169a6c7bd2c 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -6342,18 +6342,18 @@ namespace ranges { inline constexpr _Chunk_by_fn chunk_by; } // namespace views - template - requires input_range<_Vw> + template + requires view<_Vw> class stride_view : public view_interface> { private: /* [[no_unique_address]] */ _Vw _Range; range_difference_t<_Vw> _Stride; template - class _Iterator_base {}; + class _Category_base {}; template - class _Iterator_base<_BaseTy> { + class _Category_base<_BaseTy> { private: using _BaseCategory = typename iterator_traits>::iterator_category; @@ -6363,7 +6363,7 @@ namespace ranges { }; template - class _Iterator : public _Iterator_base<_Maybe_const<_Const, _Vw>> { + class _Iterator : public _Category_base<_Maybe_const<_Const, _Vw>> { private: friend stride_view; diff --git a/tests/std/tests/P1899R3_views_stride/test.cpp b/tests/std/tests/P1899R3_views_stride/test.cpp index 77bd5646474..9b0fc37e637 100644 --- a/tests/std/tests/P1899R3_views_stride/test.cpp +++ b/tests/std/tests/P1899R3_views_stride/test.cpp @@ -448,8 +448,8 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { assert(ci2 > ci); assert(ci2 >= ci); if constexpr (three_way_comparable>) { - assert(ci <=> ci4 == strong_ordering::equal); assert(ci <=> ci2 == strong_ordering::less); + assert(ci <=> ci4 == strong_ordering::equal); assert(ci2 <=> ci == strong_ordering::greater); } @@ -460,9 +460,9 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { assert(ci2 > i); assert(ci2 >= i); if constexpr (three_way_comparable>) { - assert(ci <=> ci2 == strong_ordering::less); - assert(ci <=> ci4 == strong_ordering::equal); - assert(ci2 <=> ci == strong_ordering::greater); + assert(i <=> ci2 == strong_ordering::less); + assert(i <=> ci4 == strong_ordering::equal); + assert(ci2 <=> i == strong_ordering::greater); } } }