std::ranges::stride_view<V>::begin
From cppreference.com
< cpp | ranges | stride 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::stride_view
stride_view::begin
(C++26)
constexpr auto begin() requires (!__simple_view<V>);
(1)
(since C++23)
constexpr auto begin() const requires ranges::range <const V>;
(2)
(since C++23)
Returns an iterator to the first element of the stride_view
.
1) Equivalent to return iterator<false>(this, ranges::begin (base_));.
2) Equivalent to return iterator<true>(this, ranges::begin (base_));.
Overload (1) does not participate in overload resolution if V is a simple view (that is, if V and const V are views with the same iterator and sentinel types).
Contents
[edit] Parameters
(none)
[edit] Return value
Iterator to the first element of the view.
[edit] Example
A link to test: Compiler Explorer.
Run this code
#include <print> #include <ranges> int main() { constexpr auto v = {'A', 'B', 'C'}; const auto x = v | std::views::stride (2); const auto y = v | std::views::reverse | std::views::stride (2); const auto z = v | std::views::stride (2) | std::views::reverse ; std::println ("{} {} {}", *x.begin(), *y.begin(), *z.begin()); }
Output:
A C C