The OpenD Programming Language

stride

Strides 1-dimensional slice.

Members

Functions

stride
auto stride(T[] array)
auto stride(T withAsSlice)

ditto

Parameters

slice

1-dimensional unpacked slice.

factor

positive stride size.

Return Value

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