The OpenD Programming Language

mir_slice.opIndexUnary

Increment ++ and Decrement -- operators for a fully defined slice.

  1. auto ref opIndexUnary(size_t[N] _indices)
  2. void opIndexUnary(Slices slices)
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    return scope
    static if(isMutable!DeepElement)
    void
    opIndexUnary
    (
    string op
    Slices...
    )
    (
    Slices slices
    )
    if (
    isFullPureSlice!Slices &&
    (
    op == `++` ||
    op == `--`
    )
    )
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )

Examples

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

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

--a[1, 0..$-1];

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

Meta