The OpenD Programming Language

IotaIterator

Step counter.

IotaIterator is used by iota.

Members

Functions

lightConst
auto lightConst()
lightImmutable
auto lightImmutable()

Variables

_index
I _index;

Examples

IotaIterator!int iota;
assert(*iota == 0);

// iteration
++iota;
assert(*iota == 1);

assert(iota[2] == 3);
assert(iota[-1] == 0);

--iota;
assert(*iota == 0);

// opBinary
assert(*(iota + 2) == 2);
assert(*(iota - 3) == -3);
assert((iota - 3) - iota == -3);

// construction
assert(*IotaIterator!int(3) == 3);
assert(iota - 1 < iota);
int[32] data;
auto iota = IotaIterator!(int*)(data.ptr);
assert(*iota == data.ptr);

// iteration
++iota;
assert(*iota == 1 + data.ptr);

assert(iota[2] == 3 + data.ptr);
assert(iota[-1] == 0 + data.ptr);

--iota;
assert(*iota == 0 + data.ptr);

// opBinary
assert(*(iota + 2) == 2 + data.ptr);
assert(*(iota - 3) == -3 + data.ptr);
assert((iota - 3) - iota == -3);

// construction
assert(*IotaIterator!(int*)(data.ptr) == data.ptr);
assert(iota - 1 < iota);

Meta