Namespaces
Variants
Actions

std::ranges::drop_while_view<V,Pred>::end

From cppreference.com
 
C++
 
Ranges library
Range adaptors
 
std::ranges::drop_while_view
constexpr auto end();
(since C++20)

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

Effectively returns ranges::end(base_), where base_ is the underlying view.

Contents

[edit] Parameters

(none)

[edit] Return value

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

[edit] Example

#include <cassert>
#include <iostream>
#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.end()[-1] == 5);
}

[edit] See also

returns an iterator to the beginning
(public member function) [edit]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant