| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
template<bool Const> struct/*outer_iterator*/; | (since C++20) (exposition only*) | |
The return type oflazy_split_view::begin, and oflazy_split_view::end when the underlying view is acommon_range andforward_range.
If eitherV orPattern is not asimple view (e.g. ifranges::iterator_t<const V> is invalid or different fromranges::iterator_t<V>),Const istrue for iterators returned from the const overloads, andfalse otherwise. IfV is a simple view,Const istrue if and only ifV is aforward_range.
| Member | Definition |
Parent | maybe-const <Const,ranges::lazy_split_view>(exposition-only member type*) |
Base | maybe-const <Const, V>(exposition-only member type*) |
iterator_concept |
|
iterator_category(present only if Base modelsforward_range) | std::input_iterator_tag |
the value type of theouter_iterator(public member class) | |
difference_type | ranges::range_difference_t<Base> |
| Member | Description |
Parent*parent_(private) | a pointer to the parent objectlazy_split_view(exposition-only member object*) |
ranges::iterator_t<Base>current_(private)(present only if V modelsforward_range) | an iterator into the underlyingview(exposition-only member object*) |
booltrailing_empty_(private) | a flag that indicates whether an empty trailing subrange (if any) was reached (exposition-only member object*) |
(constructor) | constructs an iterator (public member function) |
operator* | returns the current subrange (public member function) |
operator++operator++(int) | advances the iterator (public member function) |
cur | returns conditionally a reference to thecurrent_ (if present) or to the*parent_->current_(exposition-only member function*) |
/*outer_iterator*/()=default; | (1) | (since C++20) |
constexprexplicit/*outer_iterator*/( Parent& parent) requires(!ranges::forward_range<Base>); | (2) | (since C++20) |
constexpr/*outer_iterator*/( Parent& parent, ranges::iterator_t<Base> current) | (3) | (since C++20) |
constexpr/*outer_iterator*/(/*outer_iterator*/<!Const> i) requires Const&&std::convertible_to<ranges::iterator_t<V>, | (4) | (since C++20) |
V modelsforward_range),parent_ withi.parent_,current_ withstd::move(i.current_), andtrailing_empty_ witht.trailing_empty_.Thetrailing_empty_ is initialized with its default member initializer tofalse.
constexpr value_type operator*()const; | (since C++20) | |
Equivalent toreturn value_type{*this};.
constexpr/*outer_iterator*/& operator++(); | (1) | (since C++20) |
constexpr decltype(auto) operator++(int); | (2) | (since C++20) |
constauto end=ranges::end(parent_->base_);if(/*cur*/()== end){ trailing_empty_=false;return*this;}constauto[pbegin, pend]=ranges::subrange{parent_->pattern_};if(pbegin== pend)++/*cur*/();elseifconstexpr(/*tiny_range*/<Pattern>){/*cur*/()=ranges::find(std::move(/*cur*/()), end,*pbegin);if(/*cur*/()!= end){++/*cur*/();if(/*cur*/()== end) trailing_empty_=true;}}else{do{auto[b, p]=ranges::mismatch(/*cur*/(), end, pbegin, pend);if(p== pend){/*cur*/()= b;if(/*cur*/()== end) trailing_empty_=true;break;// The pattern matched; skip it}}while(++/*cur*/()!= end);}return*this;
ifconstexpr(ranges::forward_range<Base>){auto tmp=*this;++*this;return tmp;}else{++*this;// no return statement}
constexprauto&/*cur*/()noexcept; | (1) | (since C++20) (exposition only*) |
constexprauto&/*cur*/()constnoexcept; | (2) | (since C++20) (exposition only*) |
This convenience member function is referred to from/*outer_iterator*/::operator++(), from the non-memberoperator==(const/*outer_iterator*/&,std::default_sentinel_t), and from some member functions of the possible implementation ofinner_iterator.
ifconstexpr(ranges::forward_range<V>)return current_;elsereturn*parent->current_;
operator== (C++20) | compares the underlying iterators or the underlying iterator andstd::default_sentinel (function) |
friendconstexprbool operator==(const/*outer_iterator*/& x, const/*outer_iterator*/& y) | (1) | (since C++20) |
friendconstexprbool operator==(const/*outer_iterator*/& x, std::default_sentinel_t); | (2) | (since C++20) |
The!= operator issynthesized fromoperator==.
These functions are not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup whenstd::ranges::split_view::outer_iterator is an associated class of the arguments.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3904 | C++20 | trailing_empty_ was not initialized in constructor (4) | initialized |