Array.opSliceAssign

Assign elem to the element at idx in the array. idx must be less than length.

struct Array(T)
opSliceAssign
(
U
)
(,
size_t start
,
size_t end
)
if (
isImplicitlyConvertible!(U, T)
)

Parameters

elem U

an element that is implicitly convertible to T

Return Value

Type: auto

a reference to the element found at idx.

Examples

import std.algorithm.comparison : equal;
auto a = Array!int([1, 2, 3, 4, 5, 6]);
a[1 .. 3] = 0;
assert(a.equal([1, 0, 0, 4, 5, 6]));

Meta