Array.opIndex

Provide access to the element at idx in the array. idx must be less than length.

struct Array(T)
ref
opIndex
(
this _
)
(
size_t idx
)

Parameters

idx size_t

a positive integer

Complexity: O(1).

Return Value

Type: auto ref

a reference to the element found at idx.

Examples

auto a = Array!int([1, 2, 3]);
assert(a[2] == 3);

Meta