std::ranges::concat_view<Views...>::iterator - cppreference.com (original) (raw)
| template< bool Const > class /*iterator*/ | (1) | (exposition only*) |
|---|---|---|
| Helper concepts | ||
| template< bool Const, class... Rs >concept /*concat-is-random-access*/ = /* see description */; | (2) | (exposition only*) |
| template< bool Const, class... Rs >concept /*concat-is-bidirectional*/ = /* see description */; | (3) | (exposition only*) |
Let
Fsbe the pack that consists of all elements ofRsexcept the last element. Equivalent toLet
Fsbe the pack that consists of all elements ofRsexcept the last element. Equivalent to
Contents
- 1 Template parameters
- 2 Nested types
- 3 Data members
- 4 Member functions
- 5 Non-member functions
- 6 Example
- 7 References
[edit] Template parameters
| Const | - | whether the iterator is a constant iterator |
|---|
[edit] Nested types
| Exposition-only types | |
|---|---|
| Type | Definition |
| base-iter | std::variant<ranges::iterator_t<_maybe-const_ <Const, Views>>...>(exposition-only member type*) |
| Iterator property types | |
| Type | Definition |
| iterator_concept | an iterator tag, see below |
| iterator_category(conditionally present) | an iterator tag, see below |
| value_type | concat-value-t <_maybe-const_ <Const, Views>...> |
| difference_type | std::common_type_t<ranges::range_difference_t<_maybe-const_ <Const, Views>>...> |
[edit] Determining the iterator concept
iterator_concept is defined as follows:
- If
_[concat-is-random-access](iterator.html#concat-is-random-access)_<Const, Views...> is modeled,iterator_conceptdenotes std::random_access_iterator_tag. - Otherwise, if
_[concat-is-bidirectional](iterator.html#concat-is-bidirectional)_<Const, Views...> is modeled,iterator_conceptdenotes std::bidirectional_iterator_tag. - Otherwise, if
_[all-forward](../../ranges.html#all-forward "cpp/ranges")_<Const, Views...> is modeled,iterator_conceptdenotes std::forward_iterator_tag. - Otherwise,
iterator_conceptdenotes std::input_iterator_tag.
[edit] Determining the iterator category
iterator_category is defined if and only if _[all-forward](../../ranges.html#all-forward "cpp/ranges")_ <Const, Views...> is modeled. In this case, it is defined as follows:
- If std::is_reference_v<
_[concat-reference-t](../concat%5Fview.html#concat-reference-t "cpp/ranges/concat view")_<_[maybe-const](../../ranges.html#maybe-const "cpp/ranges")_<Const, Views>...>> is false,iterator_categorydenotes std::input_iterator_tag. - Otherwise, let
Csdenote the pack of types std::iterator_traits<ranges::iterator_t<_[maybe-const](../../ranges.html#maybe-const "cpp/ranges")_<Const, Views>>>::iterator_category...:- If (std::derived_from<Cs, std::random_access_iterator_tag> && ...) &&
``_[concat-is-random-access](iterator.html#concat-is-random-access)_<Const, Views...> is true,iterator_categorydenotes std::random_access_iterator_tag. - Otherwise, if (std::derived_from<Cs, std::bidirectional_iterator_tag> && ...) &&
``_[concat-is-bidirectional](iterator.html#concat-is-bidirectional)_<Const, Views...> is true,iterator_categorydenotes std::bidirectional_iterator_tag. - Otherwise, if (std::derived_from<Cs, std::forward_iterator_tag> && ...) is true,
iterator_categorydenotes std::forward_iterator_tag. - Otherwise,
iterator_categorydenotes std::input_iterator_tag.
- If (std::derived_from<Cs, std::random_access_iterator_tag> && ...) &&
[edit] Data members
| Member | Definition |
|---|---|
| maybe-const <Const, ranges::concat_view>* parent_ | a pointer to the parent concat_view(exposition-only member object*) |
| base-iter it_ | an iterator into the current view(exposition-only member object*) |
[edit] Member functions
| (constructor) | constructs an iterator (public member function) |
|---|---|
| operator* | accesses the element (public member function) |
| operator[] | accesses an element by index (public member function) |
| operator++operator++(int)operator--operator--(int)operator+=operator-= | advances or decrements the underlying iterator (public member function) [edit] |
| Exposition-only function templates | |
| _satisfy | replaces it_ with the beginning of the next view, if it_ is the end of current view(exposition-only member function*) |
| _prev | decrements it_ such that it points to the previous position(exposition-only member function*) |
| _advance-fwd | advances the current position on given offset(exposition-only member function*) |
| _advance-bwd | decrements the current position on given value(exposition-only member function*) |
[edit] Non-member functions
[edit] Example
The preliminary version can be checked out on Compiler Explorer.
Output:
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
[edit] References
C++26 standard (ISO/IEC 14882:2026):
26.7.18.3 Class template
concat_view::iterator[range.concat.iterator]