The OpenD Programming Language

subSlices

Maps index pairs to subslices.

  1. Slice!(SubSliceIterator!(Iterator, Sliceable), N, kind) subSlices(Sliceable sliceable, Slice!(Iterator, N, kind) slices)
    Slice!(SubSliceIterator!(Iterator, Sliceable), N, kind)
    subSlices
    (
    Iterator
    size_t N
    SliceKind kind
    Sliceable
    )
    (
    Sliceable sliceable
    ,
    Slice!(Iterator, N, kind) slices
    )
  2. auto subSlices(Sliceable sliceable, S[] slices)
  3. auto subSlices(Sliceable sliceable, S slices)

Parameters

sliceable Sliceable

pointer, array, ndslice, series, or something sliceable with [a .. b].

slices Slice!(Iterator, N, kind)

ndslice composed of index pairs.

Return Value

Type: Slice!(SubSliceIterator!(Iterator, Sliceable), N, kind)

ndslice composed of subslices.

Examples

import mir.functional: staticArray;
auto subs =[
        staticArray(2, 4),
        staticArray(2, 10),
    ];
auto sliceable = 10.iota;

auto r = sliceable.subSlices(subs);
assert(r == [
    iota([4 - 2], 2),
    iota([10 - 2], 2),
    ]);

See Also

Meta