The OpenD Programming Language

ndarray

Allocates a common n-dimensional array from a slice.

ndarray
(
Iterator
size_t N
SliceKind kind
)
(
Slice!(Iterator, N, kind) slice
)

Parameters

slice Slice!(Iterator, N, kind)

slice

Return Value

Type: auto

multidimensional D array

Examples

import mir.ndslice.topology : iota;
auto slice = iota(3, 4);
auto m = slice.ndarray;
static assert(is(typeof(m) == sizediff_t[][])); // sizediff_t is long for 64 bit platforms
assert(m == [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]);

Meta