std::ranges...er_iterator(3)
πΈ NAME πΈ
hey bestie π welcome to the std::ranges...er_iterator(3) page, folded in from the C++ Standard Libary manual (yes, that's the manual name, and yes, I'm keeping the spelling exactly as it came to me π
). This page is all about:
std::ranges::lazy_split_view::inner_iteratorβstd::ranges::lazy_split_view::inner_iterator
β¨ Synopsis β¨
okay so the synopsis is giving exposition-only iterator energy:
template< bool Const > (since C++20)
struct /*inner_iterator*/; (exposition only*)
This is the return type of lazy_split_view::outer_iterator::value_type::begin().
Const matches the template argument of outer_iterator.
𧬠Member types π§¬
Member type β Definition:
Baseβconst VifConstistrue, otherwiseV(exposition-only member type*).iterator_concept(C++20)β equivalent to/*outer_iterator*/<Const>::iterator_concept, that isstd::forward_iterator_tagifBasemodelsforward_range, orstd::input_iterator_tagotherwise.iterator_category(C++20)β here's the tea:- Not present if
Basedoes not modelforward_range. std::forward_iterator_tagifstd::iterator_traits<ranges::iterator_t<Base>>::iterator_categorymodelsstd::derived_from<std::forward_iterator_tag>.std::iterator_traits<ranges::iterator_t<Base>>::iterator_categoryotherwise.
- Not present if
value_type(C++20)βranges::range_value_t<Base>.difference_type(C++20)βranges::range_difference_t<Base>.
ποΈ Data members ποΈ
Member object β Definition:
i_(private) β an iterator of type/*outer_iterator*/<Const>into the underlying view of the parentlazy_split_view. (exposition-only member object*)incremented_(private) β a boolean flag that indicates whether theoperator++was invoked on this object at least once. (exposition-only member object*)
π Member functions π
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++(C++20)β advances the iterator (public member function).operator++(int)(C++20)β advances the iterator (public member function).
π Member functions π
okay now we go function by function, main character energy only π:
std::ranges::lazy_split_view::inner_iterator::inner_iterator
(1)(since C++20):
/*inner_iterator*/() = default;
(2)(since C++20):
constexpr explicit /*inner_iterator*/( /*outer_iterator*/<Const> i );
- Value initializes data member
i_via its default member initializer (= /*outer_iterator*/<Const>()). - Initializes
i_withstd::move(i).
The data member incremented_ is initialized with its default member initializer to false.
std::ranges::lazy_split_view::inner_iterator::base
(1)(since C++20):
constexpr const ranges::iterator_t<Base>& base() const & noexcept;
(2)(since C++20):
constexpr ranges::iterator_t<Base> base() &&
requires ranges::forward_range<V>;
Returns a copy of the underlying iterator.
- Copy constructs the result from the underlying iterator. Equivalent to
return i_./*cur*/();. - Move constructs the result from the underlying iterator. Equivalent to
return std::move(i_./*cur*/());.
std::ranges::lazy_split_view::inner_iterator::operator*
constexpr decltype(auto) operator*() const; (since C++20)
Returns the element the underlying iterator points to.
Equivalent to return *i_./*cur*/();.
std::ranges::lazy_split_view::inner_iterator::operator++
(1)(since C++20):
constexpr /*inner_iterator*/& operator++();
(2)(since C++20):
constexpr decltype(auto) operator++(int);
- The function body is equivalent to
incremented_ = true;
if constexpr (!ranges::forward_range<Base>)
{
if constexpr (Pattern::size() == 0)
return *this;
}
++i_./*cur*/();
return *this;
- Equivalent to
if constexpr (ranges::forward_range<Base>)
{
auto tmp = *this;
++*this;
return tmp;
}
else
++*this; // no return statement
π Non-member functions π
operator==(C++20)β compares the iterators or the iterator andstd::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).
operator==(std::ranges::split_view::inner_iterator)
(1)(since C++20):
friend constexpr bool operator==( const /*inner_iterator*/& x,
const /*inner_iterator*/& y )
requires forward_range<Base>;
(2)(since C++20):
friend constexpr bool operator==( const /*inner_iterator*/& x,
std::default_sentinel_t );
- Equivalent to
return x.i_./*cur*/() == y.i_./*cur*/();. - The function body is equivalent to
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.
iter_move(std::ranges::split_view::inner_iterator)
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.
iter_swap(std::ranges::split_view::inner_iterator)
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.
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- LWG 3591 β Applied to: C++20. Behavior as published: the
&&overload ofbasemight invalidate outer iterators. Correct behavior: constraints added. - LWG 3593 β Applied to: C++20. Behavior as published: the
const&overload ofbasereturns a reference but might not benoexcept. Correct behavior: madenoexcept.
okay bestie, that's the whole page π β source: http://cppreference.com, version/date: 2024.06.10, and the page title is std::ranges...er_iterator(3). now go slay those ranges β¨π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms