The OpenD Programming Language

mir_slice.selectFront

Select the first n elements for the dimension.

struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
return scope
selectFront
(
size_t dimension
)
(
size_t n
)
if (
0 < N_ &&
N_ < 255
&&
!(
kind_ == Canonical &&
N_ == 1
)
&&
Labels_.length <= N_
&&
isIterator!Iterator_
)

Parameters

dimension

Dimension to slice.

n size_t

count of elements for the dimension

Return Value

Type: auto

ndslice with length!dimension equal to n.

Examples

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

Meta