constexpr auto end() const; | (since C++20) |
Returns an iterator
or a sentinel
representing the end of the resulting subrange.
Equivalent to:
constexpr auto end() { if constexpr (ranges::common_range<V>) { return /*iterator*/{ *this, ranges::end(base_), {} }; } else { return /*sentinel*/{ *this }; } }
(none).
#include <iostream> #include <ranges> #include <string_view> int main() { constexpr std::string_view keywords{ "bitand bitor bool break" }; std::ranges::split_view kw{ keywords, ' ' }; const auto count = std::ranges::distance(kw.begin(), kw.end()); std::cout << "Words count: " << count << '\n'; }
Output:
Words count: 4
(C++20) | returns an iterator to the beginning (public member function) |
(C++20) | returns an iterator or a sentinel to the end (public member function of std::ranges::lazy_split_view<V,Pattern> ) |
(C++20) | returns a sentinel indicating the end of a range (customization point object) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/split_view/end