N-dimensional slice composed of indices
auto slice = ndiota(2, 3); static immutable array = [[[0, 0], [0, 1], [0, 2]], [[1, 0], [1, 1], [1, 2]]]; assert(slice == array);
auto im = ndiota(7, 9); assert(im[2, 1] == [2, 1]); //slicing works correctly auto cm = im[1 .. $, 4 .. $]; assert(cm[2, 1] == [3, 5]);
Returns a slice, the elements of which are equal to the initial multidimensional index value. For a flattened (contiguous) index, see iota.