class /*inner-iterator*/
(since C++23)

The return type of chunk_view::outer-iterator::value_type::begin if V models input_range.

The name of this class (shown here as /*inner-iterator*/) is unspecified.

Data members

Typical implementations of /*inner-iterator*/ hold only one non-static data member – a pointer parent_ (the name is for exposition purposes only) to the "parent object" of type ranges::chunk_view*.

Member types

Member type Definition
iterator_concept std::input_iterator_tag
difference_type ranges::range_difference_t<V>
value_type ranges::range_value_t<V>

Member functions

constructs an iterator
(public member function)
move assigns another iterator
(public member function)
returns an iterator to the current element
(public member function)
accesses the element
(public member function)
increments the iterator
(public member function)

Non-member functions

compares the iterator with default sentinel
calculates the remained number of elements
casts the result of dereferencing the underlying iterator to its associated rvalue reference type
swaps the objects pointed to by two underlying iterators


A link to Compiler Explorer.

#include <iostream>
#include <iterator>
#include <sstream>
#include <ranges>
int main()
    auto letters = std::istringstream{"ABCDEFGHIJK"};
    auto chunks = std::ranges::istream_view<char>(letters)
                | std::views::chunk(4);
    for (auto chunk : chunks)
        // chunk is an object of type chunk_view::outer_iterator::value_type
        std::cout << '[';
        for (auto inner_iter = chunk.begin(); inner_iter != std::default_sentinel;
            std::cout << *inner_iter;
        std::cout << "] ";
    std::cout << '\n';




  • C++23 standard (ISO/IEC 14882:2023):
    • Class chunk_view::inner-iterator [range.chunk.inner.iter]

See also

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.