JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
jh::ranges::zip_iterator< Iters > Struct Template Referencefinal

Iterator type for jh::ranges::zip_view. More...

#include <jh/ranges/zip_view.h>

Public Types

using difference_type = std::ptrdiff_t
using value_type = std::tuple<std::remove_cvref_t<std::iter_value_t<Iters>>...>
using reference = zip_reference_proxy<std::iter_reference_t<Iters>...>
using iterator_concept = std::input_iterator_tag

Public Member Functions

constexpr reference operator* () const
constexpr zip_iteratoroperator++ ()
constexpr zip_iterator operator++ (int)
constexpr bool operator== (const zip_iterator &other) const
constexpr bool operator!= (const zip_iterator &other) const
template<typename... Sentinels>
constexpr bool operator== (const zip_sentinel< Sentinels... > &s) const
template<typename... Sentinels>
constexpr bool operator!= (const zip_sentinel< Sentinels... > &s) const

Public Attributes

std::tuple< Iters... > iters

Detailed Description

template<typename... Iters>
struct jh::ranges::zip_iterator< Iters >

Iterator type for jh::ranges::zip_view.

zip_iterator traverses multiple input ranges in lockstep, dereferencing into a zip_reference_proxy that aggregates element references from each underlying range.

Each iterator maintains a tuple of underlying iterators (Iters...) and advances all of them together. Comparison against a corresponding zip_sentinel terminates iteration when any of the underlying iterators reaches its end, ensuring short-circuit termination on the shortest range.

Dereferencing (operator*) applies tuple_transform to dereference each underlying iterator, wrapping lvalue results with std::reference_wrapper when necessary via detail::wrap_element().

Template Parameters
ItersThe iterator types for the zipped ranges.
Note
This type is intentionally defined outside of zip_view to maintain independent template deduction and suppress clang-tidy "unused type" warnings via [[maybe_unused]].
See also
jh::ranges::zip_reference_proxy
jh::ranges::zip_sentinel
jh::ranges::zip_view

The documentation for this struct was generated from the following file: