slice to copy shape and data from
a structure with fields array and slice Note: makeSlice always returns slice with mutable elements
Initialization with default value
import std.experimental.allocator; import std.experimental.allocator.mallocator; import mir.algorithm.iteration: all; import mir.ndslice.topology: map; auto sl = Mallocator.instance.makeSlice([2, 3, 4], 10); auto ar = sl.field; assert(sl.all!"a == 10"); auto sl2 = Mallocator.instance.makeSlice(sl.map!"a * 2"); auto ar2 = sl2.field; assert(sl2.all!"a == 20"); Mallocator.instance.dispose(ar); Mallocator.instance.dispose(ar2);
Allocates an array through a specified allocator and creates an n-dimensional slice over it. See also std.experimental.allocator.