From cppreference.com
constexprautoend()requiresranges::forward_range<V>&&ranges::common_range<V>; (1) (since C++20)constexprautoend()const; (2)(since C++20)Returns an iterator or sometimes a sentinel representing the end of the
. Let
be the underlying view.
1) Returns an iterator. Equivalent to: return/*outer_iterator*/</*simple_view*/<V>&&/*simple_view*/<Pattern>>{*this,ranges::end(base_)};.
2) Returns an
or a
.
Equivalent to:
ifconstexpr(ranges::forward_range<V>&&ranges::forward_range<constV>&&ranges::common_range<constV>&&ranges::forward_range<constPattern>)return/*outer_iterator*/<true>{*this,ranges::end(base_)};elsereturnstd::default_sentinel;Return value
An
or a
representing the end of the
.
Example
Run this code
#include<iostream>#include<ranges>#include<string_view>intmain(){constexprstd::string_viewkeywords{"false float for friend"};std::ranges::lazy_split_viewkw{keywords,' '};constautocount=std::ranges::distance(kw.begin(),kw.end());std::cout<<"Words count: "<<count<<'\n';}Output:
Words count: 4 Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
C++20 lazy_split_view does not check if Pattern is a
/*simple_view*/<Pattern> is examined
C++20 the const overload (
) does not check
ranges::forward_range<constPattern>checked See also
returns an iterator to the beginning
(public member function)
returns an iterator or a sentinel to the end
(public member function of std::ranges::split_view<V,Pattern>)
(C++20)
returns an iterator to the beginning of a range
(customization point object)
(C++20)
returns a sentinel indicating the end of a range
(customization point object)