Array.opIndex - multiple declarations
Function Array.opIndex
inout ref inout(T) opIndex
(
size_t pos
) @trusted;
Parameters
Name | Description |
---|---|
pos | Index. |
Returns
The value at a specified index.
Precondition
length > pos
.
Function Array.opIndex
Returns
Random access range that iterates over elements of the array, in forward order.
Example
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[])));