stride

Strides 1-dimensional slice.

  1. auto stride(Slice!(Iterator, N, kind) slice)
    template stride(size_t factor = 2)
    @optmath
    stride
    (
    Iterator
    size_t N
    SliceKind kind
    )
    (
    Slice!(Iterator, N, kind) slice
    )
    if (
    factor > 1
    )
  2. auto stride(T[] array)
  3. auto stride(T withAsSlice)
  4. auto stride(Slice!(Iterator, N, kind) slice, ptrdiff_t factor)
  5. auto stride(T[] array, ptrdiff_t factor)
  6. auto stride(T withAsSlice, ptrdiff_t factor)

Members

Functions

stride
auto stride(Slice!(Iterator, N, kind) slice)
Undocumented in source. Be warned that the author may not have intended to support it.
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