n-dimensional slice
import mir.ndslice.topology: iota; auto slice = iota([2, 2], 1); assert(slice == [[1, 2], [3, 4]]); // Default assert(slice.reversed == [[3, 4], [1, 2]]); // Template assert(slice.reversed! 0 == [[3, 4], [1, 2]]); assert(slice.reversed! 1 == [[2, 1], [4, 3]]); assert(slice.reversed!(0, 1) == [[4, 3], [2, 1]]); assert(slice.reversed!(1, 0) == [[4, 3], [2, 1]]); assert(slice.reversed!(1, 1) == [[1, 2], [3, 4]]); assert(slice.reversed!(0, 0, 0) == [[3, 4], [1, 2]]); // Function assert(slice.reversed (0) == [[3, 4], [1, 2]]); assert(slice.reversed (1) == [[2, 1], [4, 3]]); assert(slice.reversed (0, 1) == [[4, 3], [2, 1]]); assert(slice.reversed (1, 0) == [[4, 3], [2, 1]]); assert(slice.reversed (1, 1) == [[1, 2], [3, 4]]); assert(slice.reversed (0, 0, 0) == [[3, 4], [1, 2]]);
import mir.ndslice.topology: iota, canonical; auto slice = iota([2, 2], 1).canonical; assert(slice == [[1, 2], [3, 4]]); // Template assert(slice.reversed! 0 == [[3, 4], [1, 2]]); assert(slice.reversed!(0, 0, 0) == [[3, 4], [1, 2]]); // Function assert(slice.reversed (0) == [[3, 4], [1, 2]]); assert(slice.reversed (0, 0, 0) == [[3, 4], [1, 2]]);
Reverses the direction of iteration for selected dimensions.