maybeExpand

exapand dimension if s.length!dim == 1 else do nothing but type in the same expressions of repeat/unpack/swapped/index[0]

maybeExpand
(
size_t dim
S
)
(
S s
,
size_t n
)
if (
isSlice!S
)

Examples

import mir.ndslice;
assert(iota(1, 3, 2).maybeExpand!0(2) == iota(3, 2).repeat(2).unpack);
assert(iota(3, 2).maybeExpand!0(2) == iota(3, 2));

Meta