Skip to content

Commit

Permalink
Apply more suggestions from code review
Browse files Browse the repository at this point in the history
* Rename `_Iterator_base` to `_Category_base`
* Swap `stride_view` constraints
* Fix `stride_view`'s iterator cross comparisons in tests (`ci <=> ci2` -> `i <=> ci2`)
  • Loading branch information
JMazurkiewicz committed Aug 5, 2022
1 parent 9e47f4f commit a51e22a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -6342,18 +6342,18 @@ namespace ranges {
inline constexpr _Chunk_by_fn chunk_by;
} // namespace views

template <view _Vw>
requires input_range<_Vw>
template <input_range _Vw>
requires view<_Vw>
class stride_view : public view_interface<stride_view<_Vw>> {
private:
/* [[no_unique_address]] */ _Vw _Range;
range_difference_t<_Vw> _Stride;

template <class _BaseTy>
class _Iterator_base {};
class _Category_base {};

template <forward_range _BaseTy>
class _Iterator_base<_BaseTy> {
class _Category_base<_BaseTy> {
private:
using _BaseCategory = typename iterator_traits<iterator_t<_BaseTy>>::iterator_category;

Expand All @@ -6363,7 +6363,7 @@ namespace ranges {
};

template <bool _Const>
class _Iterator : public _Iterator_base<_Maybe_const<_Const, _Vw>> {
class _Iterator : public _Category_base<_Maybe_const<_Const, _Vw>> {
private:
friend stride_view;

Expand Down
8 changes: 4 additions & 4 deletions tests/std/tests/P1899R3_views_stride/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
assert(ci2 > ci);
assert(ci2 >= ci);
if constexpr (three_way_comparable<iterator_t<const V>>) {
assert(ci <=> ci4 == strong_ordering::equal);
assert(ci <=> ci2 == strong_ordering::less);
assert(ci <=> ci4 == strong_ordering::equal);
assert(ci2 <=> ci == strong_ordering::greater);
}

Expand All @@ -460,9 +460,9 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
assert(ci2 > i);
assert(ci2 >= i);
if constexpr (three_way_comparable<iterator_t<const V>>) {
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);
}
}
}
Expand Down

0 comments on commit a51e22a

Please sign in to comment.