Skip to content

Search topics & cppreference

Search all study topics, concept maps, and 6,587 C++ and C reference pages.

std::ranges::slide_view<V>::end

Returns a sentinel or an iterator representing the end of the slide_view.

Ranges
  • C++20
  • C++23
1 min readView on cppreference
NotebookLM
constexpr auto end()
    requires (!(/*simple-view*/<V> && /*slide-caches-nothing*/<const V>));
(1) (since C++23)
constexpr auto end() const
    requires /*slide-caches-nothing*/<const V>;
(2) (since C++23)

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-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()).

Parameters

(none)

Return value

A sentinel or an iterator representing the end of the slide_view.

Example

example.cpp
#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 ]

See also

returns an iterator to the beginning
(public member function)
returns an iterator to the beginning of a range
(customization point object)
returns a sentinel indicating the end of a range
(customization point object)

Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.