std::ranges::drop_while_view<V,Pred>::begin
From cppreference.com
< cpp | ranges | drop while 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)
constexpr auto begin();
(since C++20)
Returns an iterator to the first element of the view.
Effectively returns ranges::find_if_not (base_, std::cref (pred())), where base_
is the underlying view. The behavior is undefined if *this does not store a predicate.
In order to provide the amortized constant time complexity required by the range
concept, this function caches the result within the drop_while_view
object for use on subsequent calls.
Contents
[edit] Parameters
(none)
[edit] Return value
Iterator to the first element of the view.
[edit] Example
Run this code
#include <cassert> #include <ranges> int main() { static constexpr auto data = {0, -1, -2, 3, 1, 4, 1, 5}; auto view = std::ranges::drop_while_view {data, [](int x){ return x <= 0; }}; assert (view.begin()[0] == 3); }