Array.opIndex

  1. inout(T) opIndex(size_t pos)
  2. Range opIndex()
  3. ConstRange opIndex()
    struct Array(T)
    const @trusted
    opIndex
    ()

Return Value

Random access range that iterates over elements of the array, in forward order.

Examples

const v1 = Array!int([6, 123, 34, 5]);

assert(v1[0] == 6);
assert(v1[1] == 123);
assert(v1[2] == 34);
assert(v1[3] == 5);
static assert(is(typeof(v1[0]) == const(int)));
static assert(is(typeof(v1[])));

Meta