|
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.
|
A C++20-compatible implementation of std::ranges::zip_view.
More...
#include <jh/ranges/zip_view.h>
Public Member Functions | |
| zip_view ()=default | |
Default-constructs an empty zip_view. | |
| constexpr | zip_view (Views... vs) |
Constructs a zip_view from multiple views. | |
| constexpr auto | begin () |
| Returns an iterator to the beginning of the zipped sequence. | |
| constexpr auto | end () |
| Returns a sentinel marking the end of the zipped sequence. | |
| constexpr auto | begin () const |
| Returns a const iterator to the beginning of the zipped sequence. | |
| constexpr auto | end () const |
| Returns a const sentinel marking the end of the zipped sequence. | |
A C++20-compatible implementation of std::ranges::zip_view.
The zip_view class provides a view that aggregates multiple underlying ranges into synchronized tuples of elements, effectively iterating them in parallel. Each dereference yields a zip_reference_proxy holding references (or values) to the corresponding elements from all component ranges.
Iteration stops when any of the underlying ranges is exhausted, ensuring short-circuit semantics on the shortest input range.
The class follows the same observable semantics as std::ranges::zip_view (C++23), providing a transparent fallback implementation for C++20 environments.
Example:
| Views | Parameter pack of underlying view types. |
|
default |
Default-constructs an empty zip_view.
All underlying views are value-initialized.
|
inlineexplicitconstexpr |
|
inlineconstexpr |
Returns an iterator to the beginning of the zipped sequence.
zip_iterator aggregating begin iterators of all underlying ranges.This overload participates when *this is non-const.
|
inlineconstexpr |
Returns a const iterator to the beginning of the zipped sequence.
zip_iterator aggregating begin() iterators of all underlying ranges.This overload participates when *this is const.
|
inlineconstexpr |
Returns a sentinel marking the end of the zipped sequence.
zip_sentinel aggregating end iterators of all underlying ranges.Iteration stops when any of the component iterators reaches its corresponding end sentinel.
|
inlineconstexpr |
Returns a const sentinel marking the end of the zipped sequence.
zip_sentinel aggregating end() iterators of all underlying ranges.This overload participates when *this is const.