multidimensional D array
import std.experimental.allocator; import std.experimental.allocator.mallocator; import mir.ndslice.topology : iota; auto slice = iota(3, 4); auto m = Mallocator.instance.makeNdarray!long(slice); static assert(is(typeof(m) == long[][])); static immutable ar = [[0L, 1, 2, 3], [4L, 5, 6, 7], [8L, 9, 10, 11]]; assert(m == ar); foreach (ref row; m) Mallocator.instance.dispose(row); Mallocator.instance.dispose(m);
Allocates a common n-dimensional array using data from a slice.