mir_slice.opIndexOpAssign

Op Assignment op= of a value (e.g. a number) to a fully defined slice.

  1. auto ref opIndexOpAssign(T value, size_t[N] _indices)
  2. void opIndexOpAssign(Slice!(RIterator, RN, rkind) value, Slices slices)
  3. void opIndexOpAssign(T[] value, Slices slices)
  4. void opIndexOpAssign(T value, Slices slices)
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    scope return
    @optmath
    static if(isMutable!DeepElement)
    void
    opIndexOpAssign
    (
    string op
    T
    Slices...
    )
    (,
    Slices slices
    )
    if (
    (
    isFullPureSlice!Slices ||
    )
    &&
    (
    !isDynamicArray!T ||
    isDynamicArray!DeepElement
    )
    &&
    DynamicArrayDimensionsCount!T == DynamicArrayDimensionsCount!DeepElement
    &&
    &&
    )
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )
  5. void opIndexOpAssign(T concatenation, Slices slices)

Examples

import mir.ndslice.allocation;
auto a = slice!int(2, 3);

a[] += 1;
assert(a == [[1, 1, 1], [1, 1, 1]]);

a[0..$, 0..$-1] += 2;
assert(a == [[3, 3, 1], [3, 3, 1]]);

a[1, 0..$-1] += 3;
assert(a[1] == [6, 6, 1]);

Meta