The OpenD Programming Language

mir_slice.opEquals

Select the last n elements for the dimension.

  1. bool opEquals(Slice!(IteratorR, N, rkind) rslice)
  2. bool opEquals(const(T)[] arr)
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    @trusted scope const
    bool
    opEquals
    (
    T
    )
    (
    scope const(T)[] arr
    )
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )

Return Value

Type: bool

ndslice with length!dimension equal to n.

Examples

auto a = [1, 2, 3, 4].sliced(2, 2);

assert(a != [1, 2, 3, 4, 5, 6].sliced(2, 3));
assert(a != [[1, 2, 3], [4, 5, 6]]);

assert(a == [1, 2, 3, 4].sliced(2, 2));
assert(a == [[1, 2], [3, 4]]);

assert(a != [9, 2, 3, 4].sliced(2, 2));
assert(a != [[9, 2], [3, 4]]);
import mir.ndslice.topology : iota;
auto sl = iota(3, 4);
assert(sl.selectBack!1(2) == sl[0 .. $, $ - 2 .. $]);

Meta