mir_slice.opIndex

$(BOLD Partially or fully defined slice.)

  1. auto ref opIndex(Indexes indices)
  2. auto ref opIndex(Indexes indices)
  3. auto ref opIndex(size_t[N] _indices)
  4. auto ref opIndex(size_t[N] _indices)
  5. auto ref opIndex(size_t[N] _indices)
  6. auto opIndex(size_t[I] _indices)
  7. auto opIndex(size_t[I] _indices)
  8. auto opIndex(size_t[I] _indices)
  9. auto opIndex(Slices slices)
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    scope return @trusted
    @optmath
    opIndex
    (
    Slices...
    )
    (
    Slices slices
    )
    if ()
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )
  10. auto opIndex(Slices slices)

Examples

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

/// Fully defined slice
assert(slice[] == slice);
auto sublice = slice[0..$-2, 1..$];

/// Partially defined slice
auto row = slice[3];
auto col = slice[0..$, 1];

Meta