stride

Strides 1-dimensional slice.

Parameters

factor ptrdiff_t

positive stride size.

Return Value

Type: auto

Contiguous slice with strided iterator.

Examples

auto slice = iota(6);
static immutable str = [0, 2, 4];
assert(slice.stride(2) == str); // runtime factor
assert(slice.stride!2 == str); // compile time factor
assert(slice.stride == str); // default compile time factor is 2
assert(slice.universal.stride(2) == str);

ND-compile time

auto slice = iota(4, 6);
static immutable str = [[0, 2, 4], [12, 14, 16]];
assert(slice.stride!2 == str); // compile time factor
assert(slice.stride == str); // default compile time factor is 2

See Also

Meta