dimension count
list of dimension lengths
value of the first element in a slice (optional for integer I)
n-dimensional slice composed of indices
import mir.primitives: DeepElementType; auto slice = iota(2, 3); static immutable array = [[0, 1, 2], [3, 4, 5]]; assert(slice == array); static assert(is(DeepElementType!(typeof(slice)) == sizediff_t));
int[6] data; auto slice = iota([2, 3], data.ptr); assert(slice[0, 0] == data.ptr); assert(slice[0, 1] == data.ptr + 1); assert(slice[1, 0] == data.ptr + 3);
auto im = iota([10, 5], 100); assert(im[2, 1] == 111); // 100 + 2 * 5 + 1 //slicing works correctly auto cm = im[1 .. $, 3 .. $]; assert(cm[2, 1] == 119); // 119 = 100 + (1 + 2) * 5 + (3 + 1)
iota with step
auto sl = iota([2, 3], 10, 10); assert(sl == [[10, 20, 30], [40, 50, 60]]);
Returns a slice, the elements of which are equal to the initial flattened index value.