Array.length - multiple declarations
Function Array.length
size_t length() const @property;
Returns
Array length.
Function Array.length
Expands/shrinks the array.
void length
(
size_t len
) @property @trusted;
Parameters
Name | Description |
---|---|
len | New length. |
Example
Array!int v;
v .length = 5;
assert(v .length == 5);
assert(v .capacity == 5);
v .length = 7;
assert(v .length == 7);
assert(v .capacity == 7);
assert(v[$ - 1] == 0);
v[$ - 1] = 3;
assert(v[$ - 1] == 3);
v .length = 0;
assert(v .length == 0);
assert(v .capacity == 7);