import std.range.primitives; import mir.ndslice.topology : iota, canonical; auto slice = iota(10, 20, 30).canonical; static assert(isRandomAccessRange!(typeof(slice))); static assert(hasSlicing!(typeof(slice))); static assert(hasLength!(typeof(slice))); assert(slice.shape == cast(size_t[3])[10, 20, 30]); slice.popFront; slice.popFront!1; slice.popBackExactly!2(4); assert(slice.shape == cast(size_t[3])[9, 19, 26]); auto matrix = slice.front!1; assert(matrix.shape == cast(size_t[2])[9, 26]); auto column = matrix.back!1; assert(column.shape == cast(size_t[1])[9]); slice.popFrontExactly!1(slice.length!1); assert(slice.empty == false); assert(slice.empty!1 == true); assert(slice.empty!2 == false); assert(slice.shape == cast(size_t[3])[9, 0, 26]); assert(slice.back.front!1.empty); slice.popFrontN!0(40); slice.popFrontN!2(40); assert(slice.shape == cast(size_t[3])[0, 0, 0]);
Multidimensional input range primitive.