[range.slide]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.slide)

### 25.7.30 Slide view [range.slide]

#### [25.7.30.1](#overview) Overview [[range.slide.overview]](range.slide.overview)

[1](#overview-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L14872)

slide_view takes a view and a number N and
produces a view
whose Mth element is a view over
the Mth through(M+Nâ1)th elements
of the original view[.](#overview-1.sentence-1)

If the original view has fewer than N elements,
the resulting view is empty[.](#overview-1.sentence-2)

[2](#overview-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L14882)

The name views​::​slide denotes
a range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2 Range adaptor objects"))[.](#overview-2.sentence-1)

Given subexpressions E and N,
the expression views​::​slide(E, N) is expression-equivalent toslide_view(E, N)[.](#overview-2.sentence-2)

[*Example [1](#overview-example-1)*: vector v = {1, 2, 3, 4};

for (auto i : v | views::slide(2)) { cout << '[' << i[0] << ", " << i[1] << "] "; // prints [1, 2] [2, 3] [3, 4]} â *end example*]

#### [25.7.30.2](#view) Class template slide_view [[range.slide.view]](range.slide.view)

[ð](#lib:slide_view)

namespace std::ranges {template<class V>concept [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]") = [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<V> && [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<V>; // *exposition only*template<class V>concept [*slide-caches-last*](#concept:slide-caches-last "25.7.30.2 Class template slide_­view [range.slide.view]") = // *exposition only*![*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<V> && [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<V> && [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<V>; template<class V>concept [*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]") = // *exposition only*![*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<V> && ![*slide-caches-last*](#concept:slide-caches-last "25.7.30.2 Class template slide_­view [range.slide.view]")<V>; template<[forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]") V>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V>class slide_view : public view_interface<slide_view<V>> { V *base_*; // *exposition only* range_difference_t<V> *n_*; // *exposition only*// [[range.slide.iterator]](#iterator "25.7.30.3 Class template slide_­view​::​iterator"), class template slide_view​::​*iterator*template<bool> class *iterator*; // *exposition only*// [[range.slide.sentinel]](#sentinel "25.7.30.4 Class slide_­view​::​sentinel"), class slide_view​::​*sentinel*class *sentinel*; // *exposition only*public:constexpr explicit slide_view(V base, range_difference_t<V> n); constexpr V base() const & requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]")<V> { return *base_*; }constexpr V base() && { return std::move(*base_*); }constexpr auto begin()requires (!([*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>)); constexpr auto begin() const requires [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>; constexpr auto end()requires (!([*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>)); constexpr auto end() const requires [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>; constexpr auto size() requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<V>; constexpr auto size() const requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<const V>; constexpr auto reserve_hintsize() requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<V>; constexpr auto reserve_hintsize() const requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<const V>; }; template<class R> slide_view(R&&, range_difference_t<R>) -> slide_view<views::all_t<R>>;}

[ð](#lib:slide_view,constructor_)

`constexpr explicit slide_view(V base, range_difference_t<V> n);
`

[1](#view-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L14960)

*Preconditions*: n > 0 is true[.](#view-1.sentence-1)

[2](#view-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L14964)

*Effects*: Initializes *base_* with std​::​move(base) and*n_* with n[.](#view-2.sentence-1)

[ð](#lib:begin,slide_view)

`constexpr auto begin()
  requires (!([simple-view](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [slide-caches-nothing](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>));
`

[3](#view-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L14977)

*Returns*: 

- [(3.1)](#view-3.1)

If V models [*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]"),*iterator*<false>(ranges::begin(*base_*),
 ranges::next(ranges::begin(*base_*), *n_* - 1, ranges::end(*base_*)), *n_*)

- [(3.2)](#view-3.2)

Otherwise, *iterator*<false>(ranges​::​begin(*base_*), *n_*)[.](#view-3.sentence-1)

[4](#view-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L14990)

*Remarks*: In order to provide the amortized constant-time complexity
required by the [range](range.range#concept:range "25.4.2 Ranges [range.range]") concept,
this function caches the result within the slide_view for use on subsequent calls
when V models [*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]")[.](#view-4.sentence-1)

[ð](#lib:begin,slide_view_)

`constexpr auto begin() const requires [slide-caches-nothing](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>;
`

[5](#view-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15005)

*Returns*: *iterator*<true>(ranges​::​begin(*base_*), *n_*)[.](#view-5.sentence-1)

[ð](#lib:end,slide_view)

`constexpr auto end()
  requires (!([simple-view](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [slide-caches-nothing](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>));
`

[6](#view-6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15017)

*Returns*: 

- [(6.1)](#view-6.1)

If V models [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]"),*iterator*<false>(ranges::begin(*base_*) + range_difference_t<V>(size()), *n_*)

- [(6.2)](#view-6.2)

Otherwise, if V models [*slide-caches-last*](#concept:slide-caches-last "25.7.30.2 Class template slide_­view [range.slide.view]"),*iterator*<false>(ranges::prev(ranges::end(*base_*), *n_* - 1, ranges::begin(*base_*)), *n_*)

- [(6.3)](#view-6.3)

Otherwise, if V models [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]"),*iterator*<false>(ranges::end(*base_*), ranges::end(*base_*), *n_*)

- [(6.4)](#view-6.4)

Otherwise, *sentinel*(ranges​::​end(*base_*))[.](#view-6.sentence-1)

[7](#view-7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15039)

*Remarks*: In order to provide the amortized constant-time complexity
required by the [range](range.range#concept:range "25.4.2 Ranges [range.range]") concept,
this function caches the result within the slide_view for use on subsequent calls
when V models [*slide-caches-last*](#concept:slide-caches-last "25.7.30.2 Class template slide_­view [range.slide.view]")[.](#view-7.sentence-1)

[ð](#lib:end,slide_view_)

`constexpr auto end() const requires [slide-caches-nothing](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]")<const V>;
`

[8](#view-8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15054)

*Returns*: begin() + range_difference_t<const V>(size())[.](#view-8.sentence-1)

[ð](#lib:size,slide_view)

`constexpr auto size() requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<V>;
constexpr auto size() const requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<const V>;
`

[9](#view-9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15066)

*Effects*: Equivalent to:auto sz = ranges::distance(*base_*) - *n_* + 1;if (sz < 0) sz = 0;return *to-unsigned-like*(sz);

[ð](#lib:reserve_hint,slide_view)

`constexpr auto reserve_hint() requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<V>;
constexpr auto reserve_hint() const requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<const V>;
`

[10](#view-10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15083)

*Effects*: Equivalent to:auto sz = static_cast<range_difference_t<decltype((*base_*))>>(ranges::reserve_hint(*base_*)) -*n_* + 1;if (sz < 0) sz = 0;return *to-unsigned-like*(sz);

#### [25.7.30.3](#iterator) Class template slide_view​::​*iterator* [[range.slide.iterator]](range.slide.iterator)

[ð](#lib:slide_view::iterator)

namespace std::ranges {template<[forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]") V>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V>template<bool Const>class slide_view<V>::*iterator* {using *Base* = *maybe-const*<Const, V>; // *exposition only* iterator_t<*Base*> *current_* = iterator_t<*Base*>(); // *exposition only* iterator_t<*Base*> *last_ele_* = iterator_t<*Base*>(); // *exposition only*,// present only if *Base* models [*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]") range_difference_t<*Base*> *n_* = 0; // *exposition only*constexpr *iterator*(iterator_t<*Base*> current, range_difference_t<*Base*> n) // *exposition only*requires (![*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]")<*Base*>); constexpr *iterator*(iterator_t<*Base*> current, iterator_t<*Base*> last_ele, // *exposition only* range_difference_t<*Base*> n)requires [*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]")<*Base*>; public:using iterator_category = input_iterator_tag; using iterator_concept = *see below*; using value_type = decltype(views::counted(*current_*, *n_*)); using difference_type = range_difference_t<*Base*>; *iterator*() = default; constexpr *iterator*(*iterator*<!Const> i)requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<iterator_t<V>, iterator_t<*Base*>>; constexpr auto operator*() const; constexpr *iterator*& operator++(); constexpr *iterator* operator++(int); constexpr *iterator*& operator--() requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator* operator--(int) requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator*& operator+=(difference_type x)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator*& operator-=(difference_type x)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr auto operator[](difference_type n) constrequires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr bool operator==(const *iterator*& x, const *iterator*& y); friend constexpr bool operator<(const *iterator*& x, const *iterator*& y)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr bool operator>(const *iterator*& x, const *iterator*& y)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr bool operator<=(const *iterator*& x, const *iterator*& y)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr bool operator>=(const *iterator*& x, const *iterator*& y)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr auto operator<=>(const *iterator*& x, const *iterator*& y)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*> &&[three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4 Concept three_­way_­comparable [cmp.concept]")<iterator_t<*Base*>>; friend constexpr *iterator* operator+(const *iterator*& i, difference_type n)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr *iterator* operator+(difference_type n, const *iterator*& i)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr *iterator* operator-(const *iterator*& i, difference_type n)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr difference_type operator-(const *iterator*& x, const *iterator*& y)requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<iterator_t<*Base*>, iterator_t<*Base*>>; };}

[1](#iterator-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15167)

*iterator*​::​iterator_concept is defined as follows:

- [(1.1)](#iterator-1.1)

  If *Base* models [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]"),
then iterator_concept denotes random_access_iterator_tag[.](#iterator-1.1.sentence-1)

- [(1.2)](#iterator-1.2)

  Otherwise, if *Base* models [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]"),
then iterator_concept denotes bidirectional_iterator_tag[.](#iterator-1.2.sentence-1)

- [(1.3)](#iterator-1.3)

  Otherwise, iterator_concept denotes forward_iterator_tag[.](#iterator-1.3.sentence-1)

[2](#iterator-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15180)

If the invocation of any non-const member function of *iterator* exits via an exception, the *iterator* acquires a singular value[.](#iterator-2.sentence-1)

[ð](#lib:slide_view::iterator,constructor)

`constexpr iterator(iterator_t<Base> current, range_difference_t<Base> n)
  requires (![slide-caches-first](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]")<Base>);
`

[3](#iterator-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15191)

*Effects*: Initializes *current_* with current and*n_* with n[.](#iterator-3.sentence-1)

[ð](#lib:slide_view::iterator,constructor_)

`constexpr iterator(iterator_t<Base> current, iterator_t<Base> last_ele,
                   range_difference_t<Base> n)
  requires [slide-caches-first](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]")<Base>;
`

[4](#iterator-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15205)

*Effects*: Initializes *current_* with current,*last_ele_* with last_ele, and*n_* with n[.](#iterator-4.sentence-1)

[ð](#lib:slide_view::iterator,constructor__)

`constexpr iterator(iterator<!Const> i)
  requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<iterator_t<V>, iterator_t<Base>>;
`

[5](#iterator-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15219)

*Effects*: Initializes *current_* with std​::​move(i.*current_*) and*n_* with i.*n_*[.](#iterator-5.sentence-1)

[*Note [1](#iterator-note-1)*:

*iterator*<true> can only be formed
when *Base* models [*slide-caches-nothing*](#concept:slide-caches-nothing "25.7.30.2 Class template slide_­view [range.slide.view]"),
in which case *last_ele_* is not present[.](#iterator-5.sentence-2)

â *end note*]

[ð](#lib:operator*,slide_view::iterator)

`constexpr auto operator*() const;
`

[6](#iterator-6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15236)

*Returns*: views​::​counted(*current_*, *n_*)[.](#iterator-6.sentence-1)

[ð](#lib:operator++,slide_view::iterator)

`constexpr iterator& operator++();
`

[7](#iterator-7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15247)

*Preconditions*: *current_* and *last_ele_* (if present) are incrementable[.](#iterator-7.sentence-1)

[8](#iterator-8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15251)

*Postconditions*: *current_* and *last_ele_* (if present) are
each equal to ranges​::​next(i),
where i is the value of that data member before the call[.](#iterator-8.sentence-1)

[9](#iterator-9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15257)

*Returns*: *this[.](#iterator-9.sentence-1)

[ð](#lib:operator++,slide_view::iterator_)

`constexpr iterator operator++(int);
`

[10](#iterator-10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15268)

*Effects*: Equivalent to:auto tmp = *this;++*this;return tmp;

[ð](#lib:operator--,slide_view::iterator)

`constexpr iterator& operator--() requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[11](#iterator-11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15284)

*Preconditions*: *current_* and *last_ele_* (if present) are decrementable[.](#iterator-11.sentence-1)

[12](#iterator-12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15288)

*Postconditions*: *current_* and *last_ele_* (if present) are
each equal to ranges​::​prev(i),
where i is the value of that data member before the call[.](#iterator-12.sentence-1)

[13](#iterator-13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15294)

*Returns*: *this[.](#iterator-13.sentence-1)

[ð](#lib:operator--,slide_view::iterator_)

`constexpr iterator operator--(int) requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[14](#iterator-14)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15305)

*Effects*: Equivalent to:auto tmp = *this;--*this;return tmp;

[ð](#lib:operator+=,slide_view::iterator)

`constexpr iterator& operator+=(difference_type x)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[15](#iterator-15)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15322)

*Preconditions*: *current_* + x and *last_ele_* + x (if *last_ele_* is present)
have well-defined behavior[.](#iterator-15.sentence-1)

[16](#iterator-16)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15327)

*Postconditions*: *current_* and *last_ele_* (if present) are
each equal to i + x,
where i is the value of that data member before the call[.](#iterator-16.sentence-1)

[17](#iterator-17)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15333)

*Returns*: *this[.](#iterator-17.sentence-1)

[ð](#lib:operator-=,slide_view::iterator)

`constexpr iterator& operator-=(difference_type x)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[18](#iterator-18)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15345)

*Preconditions*: *current_* - x and *last_ele_* - x (if *last_ele_* is present)
have well-defined behavior[.](#iterator-18.sentence-1)

[19](#iterator-19)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15350)

*Postconditions*: *current_* and *last_ele_* (if present) are
each equal to i - x,
where i is the value of that data member before the call[.](#iterator-19.sentence-1)

[20](#iterator-20)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15356)

*Returns*: *this[.](#iterator-20.sentence-1)

[ð](#lib:operator%5b%5d,slide_view::iterator)

`constexpr auto operator[](difference_type n) const
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[21](#iterator-21)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15368)

*Effects*: Equivalent to: return views​::​counted(*current_* + n, *n_*);

[ð](#lib:operator==,slide_view::iterator)

`friend constexpr bool operator==(const iterator& x, const iterator& y);
`

[22](#iterator-22)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15379)

*Returns*: If *last_ele_* is present,x.*last_ele_* == y.*last_ele_*;
otherwise, x.*current_* == y.*current_*[.](#iterator-22.sentence-1)

[ð](#lib:operator%3c,slide_view::iterator)

`friend constexpr bool operator<(const iterator& x, const iterator& y)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[23](#iterator-23)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15393)

*Returns*: x.*current_* < y.*current_*[.](#iterator-23.sentence-1)

[ð](#lib:operator%3e,slide_view::iterator)

`friend constexpr bool operator>(const iterator& x, const iterator& y)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[24](#iterator-24)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15405)

*Effects*: Equivalent to: return y < x;

[ð](#lib:operator%3c=,slide_view::iterator)

`friend constexpr bool operator<=(const iterator& x, const iterator& y)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[25](#iterator-25)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15417)

*Effects*: Equivalent to: return !(y < x);

[ð](#lib:operator%3e=,slide_view::iterator)

`friend constexpr bool operator>=(const iterator& x, const iterator& y)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[26](#iterator-26)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15429)

*Effects*: Equivalent to: return !(x < y);

[ð](#lib:operator%3c=%3e,slide_view::iterator)

`friend constexpr auto operator<=>(const iterator& x, const iterator& y)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base> &&
           [three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4 Concept three_­way_­comparable [cmp.concept]")<iterator_t<Base>>;
`

[27](#iterator-27)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15442)

*Returns*: x.*current_* <=> y.*current_*[.](#iterator-27.sentence-1)

[ð](#lib:operator+,slide_view::iterator)

`friend constexpr iterator operator+(const iterator& i, difference_type n)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
friend constexpr iterator operator+(difference_type n, const iterator& i)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[28](#iterator-28)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15456)

*Effects*: Equivalent to:auto r = i;
r += n;return r;

[ð](#lib:operator-,slide_view::iterator)

`friend constexpr iterator operator-(const iterator& i, difference_type n)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[29](#iterator-29)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15473)

*Effects*: Equivalent to:auto r = i;
r -= n;return r;

[ð](#lib:operator-,slide_view::iterator_)

`friend constexpr difference_type operator-(const iterator& x, const iterator& y)
  requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<iterator_t<Base>, iterator_t<Base>>;
`

[30](#iterator-30)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15490)

*Returns*: If *last_ele_* is present,x.*last_ele_* - y.*last_ele_*;
otherwise, x.*current_* - y.*current_*[.](#iterator-30.sentence-1)

#### [25.7.30.4](#sentinel) Class slide_view​::​*sentinel* [[range.slide.sentinel]](range.slide.sentinel)

[ð](#lib:slide_view::sentinel)

namespace std::ranges {template<[forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]") V>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V>class slide_view<V>::*sentinel* { sentinel_t<V> *end_* = sentinel_t<V>(); // *exposition only*constexpr explicit *sentinel*(sentinel_t<V> end); // *exposition only*public:*sentinel*() = default; friend constexpr bool operator==(const *iterator*<false>& x, const *sentinel*& y); friend constexpr range_difference_t<V>operator-(const *iterator*<false>& x, const *sentinel*& y)requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<sentinel_t<V>, iterator_t<V>>; friend constexpr range_difference_t<V>operator-(const *sentinel*& y, const *iterator*<false>& x)requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<sentinel_t<V>, iterator_t<V>>; };}

[1](#sentinel-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15524)

[*Note [1](#sentinel-note-1)*:

*sentinel* is used
only when [*slide-caches-first*](#concept:slide-caches-first "25.7.30.2 Class template slide_­view [range.slide.view]")<V> is true[.](#sentinel-1.sentence-1)

â *end note*]

[ð](#lib:slide_view::sentinel,constructor)

`constexpr explicit sentinel(sentinel_t<V> end);
`

[2](#sentinel-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15536)

*Effects*: Initializes *end_* with end[.](#sentinel-2.sentence-1)

[ð](#lib:operator==,slide_view::sentinel)

`friend constexpr bool operator==(const iterator<false>& x, const sentinel& y);
`

[3](#sentinel-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15547)

*Returns*: x.*last_ele_* == y.*end_*[.](#sentinel-3.sentence-1)

[ð](#lib:operator-,slide_view::sentinel)

`friend constexpr range_difference_t<V>
  operator-(const iterator<false>& x, const sentinel& y)
    requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<sentinel_t<V>, iterator_t<V>>;
`

[4](#sentinel-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15560)

*Returns*: x.*last_ele_* - y.*end_*[.](#sentinel-4.sentence-1)

[ð](#lib:operator-,slide_view::sentinel_)

`friend constexpr range_difference_t<V>
  operator-(const sentinel& y, const iterator<false>& x)
    requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<sentinel_t<V>, iterator_t<V>>;
`

[5](#sentinel-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15573)

*Returns*: y.*end_* - x.*last_ele_*[.](#sentinel-5.sentence-1)
