[ Web Proxy ]
URL:
Viewing: https://en.cppreference.com/cpp/ranges/split_view/end [Back]  [Original]

std::ranges::split_view<V,Pattern>::end - cppreference.com
cppreference.com
Namespaces
Variants

std::ranges::split_view<V,Pattern>::end

From cppreference.com
 
 
Ranges library
Range adaptors
 
 
constexpr auto end() const;
(since C++20)

Returns an iterator or a sentinel representing the end of the resulting subrange.

Let base_ be the underlying view. Equivalent to:

constexpr auto end()
{
    if constexpr (ranges::common_range<V>)
        return /*iterator*/{*this, ranges::end(base_), {}};
    else
        return /*sentinel*/{*this};
}

Return value

An iterator or a sentinel.

Example

#include <cassert>
#include <ranges>
#include <string_view>

int main()
{
    constexpr std::string_view keywords{"bitand bitor bool break"};
    std::ranges::split_view kw{keywords, ' '};
    assert(4 == std::ranges::distance(kw.begin(), kw.end()));
}

See also

returns an iterator to the beginning
(public member function) [edit]
returns an iterator or a sentinel to the end
(public member function of std::ranges::lazy_split_view<V,Pattern>) [edit]
returns a sentinel indicating the end of a range
(customization point object)[edit]

Web Proxy Viewer  |  New URL  |  Original Page