std::ranges::lazy_split_view<V,Pattern>::end
From cppreference.com
< cpp | ranges | lazy split 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 end() requires ranges::forward_range <V> && ranges::common_range <V>;
(1)
(since C++20)
constexpr auto end() const;
(2)
(since C++20)
Returns an iterator or sometimes a sentinel representing the end of the view
. Let base_
be the underlying view.
1) Returns an iterator. Equivalent to:
return /*outer_iterator*/</*simple_view*/<V>>{*this, ranges::end (base_)};.
2) Returns an
outer_iterator
or a std::default_sentinel .
Equivalent to:
if constexpr (ranges::forward_range <V> && ranges::forward_range <const V> && ranges::common_range <const V>) return /*outer_iterator*/<true>{*this, ranges::end (base_)}; else return std::default_sentinel ;
[edit] Return value
An outer_iterator
or a std::default_sentinel representing the end of the view
.
[edit] Example
Run this code
#include <iostream> #include <ranges> #include <string_view> int main() { constexpr std::string_view keywords{"false float for friend"}; std::ranges::lazy_split_view kw{keywords, ' '}; const auto count = std::ranges::distance (kw.begin(), kw.end()); std::cout << "Words count: " << count << '\n'; }
Output:
Words count: 4
[edit] See also
returns an iterator or a sentinel to the end
(public member function of
(public member function of
std::ranges::split_view<V,Pattern>
) [edit]