template< bool Const > struct /*inner_iterator*/; | (1) | (since C++20) |
The return type of lazy_split_view::outer_iterator::value_type::begin().
Const matches the template argument of outer_iterator.
The name of this class template (shown here as /*inner_iterator*/) is unspecified.
| Member type | Definition |
|---|---|
Base (private) | const V if Const is true, otherwise V. The name is for exposition only. |
iterator_concept (C++20) | equivalent to /*outer_iterator*/<Const>::iterator_concept, that is std::forward_iterator_tag if Base models forward_range, or std::input_iterator_tag otherwise. |
iterator_category (C++20) |
|
value_type (C++20) | ranges::range_value_t<Base>. |
difference_type (C++20) | ranges::range_difference_t<Base>. |
Typical implementations of inner_iterator hold two non-static data members:
/*outer_iterator*/<Const> (shown here as i_ for exposition only) into the underlying view of the parent lazy_split_view. incremented_ for exposition only) that indicates whether the operator++ was invoked on this object at least once. | (constructor)
(C++20) | constructs an iterator (public member function) |
| base
(C++20) | returns the underlying iterator (public member function) |
| operator*
(C++20) | returns the current element (public member function) |
| operator++operator++(int)
(C++20) | advances the iterator (public member function) |
/*inner_iterator*/() = default; | (1) | (since C++20) |
constexpr explicit /*inner_iterator*/( /*outer_iterator*/<Const> i ); | (2) | (since C++20) |
i_ via its default member initializer (= /*outer_iterator*/<Const>()).i_ with std::move(i).The exposition-only data member incremented_ is initialized with its default member initializer to false.
constexpr const ranges::iterator_t<Base>& base() const & noexcept; | (1) | (since C++20) |
constexpr ranges::iterator_t<Base> base() &&
requires ranges::forward_range<V>;
| (2) | (since C++20) |
Returns a copy of the underlying iterator.
return i_./*cur*/();.return std::move(i_./*cur*/());. constexpr decltype(auto) operator*() const; | (since C++20) |
Returns the element the underlying iterator points to.
Equivalent to return *i_./*cur*/();.
constexpr /*inner_iterator*/& operator++(); | (1) | (since C++20) |
constexpr decltype(auto) operator++(int); | (2) | (since C++20) |
incremented_ = true;
if constexpr (!ranges::forward_range<Base>) {
if constexpr (Pattern::size() == 0) {
return *this;
}
}
++i_./*cur*/();
return *this;
if constexpr (ranges::forward_range<Base>) {
auto tmp = *this;
++*this;
return tmp;
} else {
++*this; // no return statement
}
| operator==
(C++20) | compares the iterators or the iterator and std::default_sentinel (function) |
| iter_move
(C++20) | casts the result of dereferencing the underlying iterator to its associated rvalue reference type (function) |
| iter_swap
(C++20) | swaps the objects pointed to by two underlying iterators (function) |
friend constexpr bool operator==( const /*inner_iterator*/& x,
const /*inner_iterator*/& y )
requires forward_range<Base>;
| (1) | (since C++20) |
friend constexpr bool operator==( const /*inner_iterator*/& x,
std::default_sentinel_t );
| (2) | (since C++20) |
return x.i_./*cur*/() == y.i_./*cur*/();.auto [pcur, pend] = ranges::subrange{x.i_.parent_->pattern_};
auto end = ranges::end(x.i_.parent_->base_);
if constexpr (/*tiny_range*/<Pattern>) {
const auto& cur = x.i_./*cur*/();
if (cur == end) return true;
if (pcur == pend) return x.incremented_;
return *cur == *pcur;
} else {
auto cur = x.i_./*cur*/();
if (cur == end) return true;
if (pcur == pend) return x.incremented_;
do {
if (*cur != *pcur) return false;
if (++pcur == pend) return true;
} while (++cur != end);
return false;
}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::inner_iterator is an associated class of the arguments.
friend constexpr decltype(auto) iter_move( const /*inner_iterator*/& i )
noexcept(noexcept(ranges::iter_move(i.i_./*cur*/())));
| (since C++20) |
Equivalent to return ranges::iter_move(i.i_./*cur*/());.
This function is not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::ranges::split_view::inner_iterator is an associated class of the arguments.
friend constexpr void iter_swap( const /*inner_iterator*/& x,
const /*inner_iterator*/& y )
noexcept(noexcept(ranges::iter_swap(x.i_.current, y.i_.current)))
requires std::indirectly_swappable<ranges::iterator_t<Base>>;
| (since C++20) |
Equivalent to ranges::iter_swap(x.i_./*cur*/(), y.i_./*cur*/()).
This function is not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::ranges::split_view::inner_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 3591 | C++20 | the && overload of base might invalidate outer iterators | constraints added |
| LWG 3593 | C++20 | the const& overload of base returns a reference but might not be noexcept | made noexcept |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/lazy_split_view/inner_iterator