Embedded Multicore Building Blocks V1.0.0
|
Zip container for two iterators. More...
#include <zip_iterator.h>
Public Types | |
Iterator Typedefs | |
Necessary typedefs for iterators (std compatibility). | |
typedef std::random_access_iterator_tag | iterator_category |
typedef std::iterator_traits< IteratorA >::difference_type | difference_type |
typedef std::iterator_traits< IteratorA >::reference | RefA |
typedef std::iterator_traits< IteratorB >::reference | RefB |
typedef std::iterator_traits< IteratorA >::value_type | ValueA |
typedef std::iterator_traits< IteratorB >::value_type | ValueB |
typedef ZipPair< ValueA, ValueB > | value_type |
typedef ZipPair< RefA, RefB > | reference |
typedef ZipPair< RefA, RefB > | pointer |
Public Member Functions | |
ZipIterator (IteratorA iter_a, IteratorB iter_b) | |
Constructs a zip iterator from two iterators of any type. More... | |
bool | operator== (const ZipIterator &other) const |
Compares two zip iterators for equality. More... | |
bool | operator!= (const ZipIterator &other) const |
Compares two zip iterators for inequality. More... | |
void | operator++ () |
Applies prefix increment on both iterators. More... | |
void | operator-- () |
Applies prefix decrement on both iterators. More... | |
ZipIterator< IteratorA, IteratorB > | operator+ (difference_type distance) const |
Returns an instance of a zip iterator where both iterators have been advanced by the specified distance. More... | |
ZipIterator< IteratorA, IteratorB > | operator- (difference_type distance) const |
Returns an instance of a zip iterator where both iterators have been regressed by the specified distance. More... | |
ZipIterator< IteratorA, IteratorB > & | operator+= (difference_type distance) |
Advances both iterators by the specified distance. More... | |
ZipIterator< IteratorA, IteratorB > & | operator-= (difference_type distance) |
Regresses both iterators by the specified distance. More... | |
difference_type | operator- (const ZipIterator< IteratorA, IteratorB > &other) const |
Computes the distance between two zip iterators. More... | |
reference | operator* () const |
Dereferences the zip iterator. More... | |
Zip container for two iterators.
This container allows zipping two iterators together, thus enabling them to be used in situations where only one iterator can be used. Any operation applied to the zip iterator will subsequently be applied to the contained iterators. Dereferencing the iterator will return a ZipPair containing the values referenced by the iterators.
difference_type
or that at least the first iterator's difference_type
can be implicitly converted to the second iterator's difference_type
. Moreover, when calculating the distance between two ZipIterators, the distances between both pairs of iterators are equal. IteratorA | First iterator |
IteratorB | Second iterator |
embb::algorithms::ZipIterator< IteratorA, IteratorB >::ZipIterator | ( | IteratorA | iter_a, |
IteratorB | iter_b | ||
) |
Constructs a zip iterator from two iterators of any type.
[in] | iter_a | First iterator |
[in] | iter_b | Second iterator |
bool embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator== | ( | const ZipIterator< IteratorA, IteratorB > & | other | ) | const |
Compares two zip iterators for equality.
true
if zip iterators are equal, otherwise false
[in] | other | Reference to right-hand side of equality operator |
bool embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator!= | ( | const ZipIterator< IteratorA, IteratorB > & | other | ) | const |
Compares two zip iterators for inequality.
true
if any iterator doesn't equal the other, otherwise false
[in] | other | Reference to right-hand side of inequality operator |
void embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator++ | ( | ) |
Applies prefix increment on both iterators.
void embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator-- | ( | ) |
Applies prefix decrement on both iterators.
ZipIterator<IteratorA, IteratorB> embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator+ | ( | difference_type | distance | ) | const |
Returns an instance of a zip iterator where both iterators have been advanced by the specified distance.
[in] | distance | Number of elements to advance the iterators |
ZipIterator<IteratorA, IteratorB> embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator- | ( | difference_type | distance | ) | const |
Returns an instance of a zip iterator where both iterators have been regressed by the specified distance.
[in] | distance | Number of elements to regress the iterators |
ZipIterator<IteratorA, IteratorB>& embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator+= | ( | difference_type | distance | ) |
Advances both iterators by the specified distance.
*this
[in] | distance | Number of elements to advance the iterators |
ZipIterator<IteratorA, IteratorB>& embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator-= | ( | difference_type | distance | ) |
Regresses both iterators by the specified distance.
*this
[in] | distance | Number of elements to regress the iterators |
difference_type embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator- | ( | const ZipIterator< IteratorA, IteratorB > & | other | ) | const |
Computes the distance between two zip iterators.
It is assumed that both iterator pairs have the same distance.
[in] | other | Reference to right-hand side of subtraction operator |
reference embb::algorithms::ZipIterator< IteratorA, IteratorB >::operator* | ( | ) | const |
Dereferences the zip iterator.