C++ zip
|
Bidirectional iterator over multiple iterators simultaneously. More...
#include <zip.hpp>
Public Types | |
using | iterator_category = std::bidirectional_iterator_tag |
Supports bidirectional traversal. | |
using | difference_type = std::ptrdiff_t |
The difference between two iterators. | |
using | value_type = std::tuple< typename std::iterator_traits< Iterators >::reference... > |
A tuple of references from each of the zipped iterators. | |
using | pointer = std::tuple< typename std::iterator_traits< Iterators >::pointer... > |
A tuple of pointers from each of the zipped iterators. | |
using | reference = std::tuple< typename std::iterator_traits< Iterators >::reference... > |
A tuple of references from each of the zipped iterators. | |
Public Member Functions | |
zip_iterator (Iterators... iterators) | |
Constructs a zip_iterator from the provided iterators. More... | |
value_type | operator* () const |
Dereferences the zip_iterator to obtain a tuple of references from each iterator. More... | |
bool | operator== (const zip_iterator &other) const |
Checks if two zip_iterator instances are equal. More... | |
bool | operator!= (const zip_iterator &other) const |
Checks if two zip_iterator instances are not equal. More... | |
zip_iterator & | operator++ () |
Advances the zip_iterator by one position. More... | |
zip_iterator | operator+ (const std::size_t offset) const |
Returns a new zip_iterator advanced by a specified offset. More... | |
zip_iterator | operator+ (const zip_iterator &other) const |
Returns a new zip_iterator advanced by the distance between two iterators. More... | |
zip_iterator & | operator-- () |
Moves the zip_iterator back by one position. More... | |
zip_iterator | operator- (const int offset) const |
Returns a new zip_iterator moved back by a specified offset. More... | |
zip_iterator | operator- (const zip_iterator &other) const |
Returns the distance between two zip_iterator instances. More... | |
Bidirectional iterator over multiple iterators simultaneously.
Iterators | Types of the iterators to be zipped. Each iterator should support bidirectional iteration (i.e., it should support ++ , -- , and dereferencing). |
|
inlineexplicit |
Constructs a zip_iterator
from the provided iterators.
iterators | The iterators to be zipped together. |
|
inline |
Checks if two zip_iterator
instances are not equal.
other | The other zip_iterator to compare with. |
true
if the iterators are not equal, false
otherwise.
|
inline |
Dereferences the zip_iterator
to obtain a tuple of references from each iterator.
|
inline |
Returns a new zip_iterator
advanced by a specified offset.
offset | The number of positions to advance. |
zip_iterator
advanced by the specified offset.
|
inline |
Returns a new zip_iterator
advanced by the distance between two iterators.
other | The zip_iterator to measure the distance to. |
zip_iterator
advanced by the distance to the specified iterator.
|
inline |
Advances the zip_iterator
by one position.
zip_iterator
.
|
inline |
Returns a new zip_iterator
moved back by a specified offset.
offset | The number of positions to move back. |
zip_iterator
moved back by the specified offset.
|
inline |
Returns the distance between two zip_iterator
instances.
other | The zip_iterator to measure the distance from. |
zip_iterator
moved back by the distance to the specified iterator.
|
inline |
Moves the zip_iterator
back by one position.
zip_iterator
.
|
inline |
Checks if two zip_iterator
instances are equal.
other | The other zip_iterator to compare with. |
true
if the iterators are equal, false
otherwise.