The OpenD Programming Language

uninitRCslice

Allocates an n-dimensional reference-counted (thread-safe) slice without memory initialisation.

Slice!(RCI!T, N)
uninitRCslice
(
T
size_t N
)
(
size_t[N] lengths...
)

Parameters

lengths size_t[N]

List of lengths for each dimension.

Return Value

Type: Slice!(RCI!T, N)

n-dimensional slice

Examples

import mir.ndslice.slice: Slice;
import mir.rc.array: RCI;
auto tensor = uninitRCslice!int(5, 6, 7);
tensor[] = 1;
assert(tensor.length == 5);
assert(tensor.elementCount == 5 * 6 * 7);
static assert(is(typeof(tensor) == Slice!(RCI!int, 3)));

Meta