std::ranges::slide_view<V>::end
From cppreference.com
< cpp | ranges | slide view
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Ranges library
(C++23)(C++23)
(C++26)(C++26)
(C++23)(C++23)
(C++26)(C++26)
(C++26)(C++26)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
(C++23)(C++23)
std::ranges::slide_view
slide_view::end
(C++26)
Member functions
Non-member functions
Member functions
Non-member functions
constexpr auto end()
requires (!(/*simple-view*/<V> && /*slide-caches-nothing*/<const V>));
(1)
(since C++23)
requires (!(/*simple-view*/<V> && /*slide-caches-nothing*/<const V>));
constexpr auto end() const
requires /*slide-caches-nothing*/<const V>;
(2)
(since C++23)
requires /*slide-caches-nothing*/<const V>;
Returns a sentinel or an iterator representing the end of the slide_view
.
1) Let
base_
and n_
be the underlying data members. Equivalent to:
- If V models
slide-caches-nothing
, return iterator<false>(ranges::begin (base_) + ranges::range_difference_t <V>(size()), n_);. - Otherwise, if V models
slide-caches-last
, return iterator<false>(ranges::prev (ranges::end (base_), n_ - 1, ranges::begin (base_)), n_);. - Otherwise, if V models
common_range
, return iterator<false>(ranges::end (base_), ranges::end (base_), n_);. - Otherwise, return sentinel(ranges::end (base_));.
If V models
slide-caches-last
, this function caches the result within the cached_end_
for use on subsequent calls. This is necessary to provide the amortized constant-time complexity required by the range
.2) Equivalent to begin() + ranges::range_difference_t <const V>(size()).
Contents
[edit] Parameters
(none)
[edit] Return value
A sentinel or an iterator representing the end of the slide_view
.
[edit] Example
Run this code
#include <iostream> #include <ranges> int main() { static constexpr auto source = {'A', 'B', 'C', 'D'}; for (const auto subrange: source | std::views::slide (3)) { std::cout << "[ "; for (auto it = subrange.begin(); it != subrange.end(); ++it) std::cout << *it << ' '; std::cout << "]\n"; } }
Output:
[ A B C ] [ B C D ]