cpp / latest / ranges / elements_view / iterator.html /

std::ranges::elements_view<V,N>::iterator

template< bool Const >
class /*iterator*/;
(since C++20)

The return type of elements_view::begin, and of elements_view::end when the underlying view is a common_range.

The type /*iterator*/<true> is returned by the const-qualified overloads. The type /*iterator*/<false> is returned by the non-const-qualified overloads.

The name of this class template (shown here as iterator) is unspecified.

Member types

Member type Definition
Base (private) const V if Const is true, otherwise V. The name is for exposition only
iterator_concept std::random_access_iterator_tag if Base models random_access_range,
std::bidirectional_iterator_tag if Base models bidirectional_range,
std::forward_iterator_tag if Base models forward_range,
std::input_iterator_tag otherwise
iterator_category Not defined if Base does not model forward_range.
value_type std::remove_cvref_t<std::tuple_element_t<N, ranges::range_value_t<Base>>>
difference_type ranges::range_difference_t<Base>

Member objects

Member name Definition
current_ (private) an object of type ranges::iterator_t<Base>, the name is for exposition only

Member functions

(C++20)
constructs an iterator
(public member function)
(C++20)
returns the underlying iterator
(public member function)
(C++20)
accesses the N-th tuple element
(public member function)
(C++20)
accesses an element by index
(public member function)
(C++20)
advances or decrements the underlying iterator
(public member function)

Non-member functions

(C++20)
compares the underlying iterators
(function)
(C++20)
performs iterator arithmetic
(function)

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
P2259R1 C++20 member iterator_category is always defined defined only if Base models forward_range
LWG 3555 C++20 the definition of iterator_concept ignores const made to consider

See also

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/elements_view/iterator