std::ranges::lazy_split_view<V, Pattern>::outer_iterator
struct /*outer_iterator*/;
(exposition only*)
The return type of lazy_split_view::begin
, and of lazy_split_view::end
when the underlying view is a common_range
and forward_range
.
If either V
or Pattern
is not a simple view (e.g. if ranges::iterator_t <const V> is invalid or different from ranges::iterator_t <V>), Const
is true for iterators returned from the const overloads, and false otherwise. If V
is a simple view, Const
is true if and only if V
is a forward_range
.
Contents
- 1 Member types
- 2 Data members
- 3 Member functions
- 4 Member functions
- 5 std::ranges::lazy_split_view::outer_iterator ::outer_iterator
- 6 std::ranges::lazy_split_view::outer_iterator ::operator*
- 7 std::ranges::lazy_split_view::outer_iterator ::operator++
- 8 std::ranges::lazy_split_view::outer_iterator ::cur ()
- 9 operator==(std::ranges::split_view::outer_iterator)
[edit] Member types
iterator_concept
- std::forward_iterator_tag , if
Base
modelsforward_range
, - std::input_iterator_tag , otherwise
difference_type
ranges::range_difference_t <Base>
[edit] Data members
parent_
(private)
a pointer to the parent object lazy_split_view
(exposition-only member object*)
current_
(private) (present only if
V
models forward_range
)
an iterator into the underlying view
(exposition-only member object*)
trailing_empty_
(private)
a flag that indicates whether an empty trailing subrange (if any) was reached(exposition-only member object*)
[edit] Member functions
(public member function)
(public member function)
(public member function)
current_
(if present) or to the *parent_
->current_
(exposition-only member function*)
[edit] Member functions
std::ranges::lazy_split_view::outer_iterator ::outer_iterator
requires (!ranges::forward_range <Base>);
ranges::iterator_t <Base> current )
requires Const && std::convertible_to <ranges::iterator_t <V>,
- parent_ = nullptr;,
- current_ = iterator_t<Base>(); (present only if
V
modelsforward_range
),
parent_
with i.parent_, current_
with std::move(i.current_), and trailing_empty_
with t.trailing_empty_.The trailing_empty_
is initialized with its default member initializer to false.
std::ranges::lazy_split_view::outer_iterator ::operator*
Equivalent to return value_type{*this};.
std::ranges::lazy_split_view::outer_iterator ::operator++
const auto end = ranges::end (parent_->base_); if (/*cur*/() == end) { trailing_empty_ = false; return *this; } const auto [pbegin, pend] = ranges::subrange {parent_->pattern_}; if (pbegin == pend) ++/*cur*/(); else if constexpr (/*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;
if constexpr (ranges::forward_range <Base>) { auto tmp = *this; ++*this; return tmp; } else { ++*this; // no return statement }
std::ranges::lazy_split_view::outer_iterator ::cur ()
(exposition only*)
(exposition only*)
This convenience member function is referred to from /*outer_iterator*/::operator++(), from the non-member operator==(const /*outer_iterator*/&, std::default_sentinel_t ), and from some member functions of the possible implementation of inner_iterator
.
if constexpr (ranges::forward_range <V>) return current_; else return *parent->current_;
[edit] Non-member functions
(function)
operator==(std::ranges::split_view::outer_iterator)
const /*outer_iterator*/& y )
std::default_sentinel_t );
The !=
operator is synthesized from operator==
.
These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::ranges::split_view::outer_iterator
is an associated class of the arguments.
[edit] Defect reports
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 |