ZipIterator

Iterates multiple iterators in lockstep.

ZipIterator is used by zip.

Members

Functions

assumeFieldsHaveZeroShift
auto assumeFieldsHaveZeroShift()

Defined if at least one of Iterators has member assumeFieldsHaveZeroShift.

lightConst
auto lightConst()
lightImmutable
auto lightImmutable()
opBinary
auto opBinary(ptrdiff_t index)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
ptrdiff_t opBinary(typeof(this) right)
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
ptrdiff_t opCmp(typeof(this) right)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(this) right)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
auto opIndex(ptrdiff_t index)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndexAssign
auto opIndexAssign(RefTuple!(Types) value, ptrdiff_t index)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(ptrdiff_t index)
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
auto opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
auto opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
auto opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
void opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_iterators
Iterators _iterators;

Examples

import mir.ndslice.traits: isIterator;

double[10] data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
alias ItA = IotaIterator!int;
alias ItB = double*;
alias ItZ = ZipIterator!(ItA, ItB);
auto zip = ItZ(ItA(3), data.ptr);
assert((*zip).a == 3);
assert((*zip).b == 1);

// iteration
++zip;
assert((*zip).a == 3 + 1);
assert((*zip).b == 1 + 1);
assert(&(*zip).b() == data.ptr + 1);

assert(zip[4].a == 3 + 5);
assert(zip[4].b == 1 + 5);
assert(&zip[4].b() == data.ptr + 5);

--zip;
assert((*zip).a == 3);
assert((*zip).b == 1);

assert((*(zip + 2)).a == 3 + 2);
assert((*(zip - 3)).a == 3 + -3);
assert((*(zip + 2)).b == 1 + 2);
assert((*(zip + 3 - 3)).b == 1);
assert((zip - 3).opBinary!"-"(zip) == -3);

assert(zip == zip);
assert(zip - 1 < zip);

static assert(isIterator!(ZipIterator!(double*, int*)));
static assert(isIterator!(ZipIterator!(immutable(double)*, immutable(int)*)));

Meta