An array to wrap. It can be a multidimensional static array or a slice of it (has a dynamic top dimension).
The first overload returns a MultidimArray with a newly allocated data Others use an existing storage.
The first overload throws an RangeError in debug build if data length isn't equal to lengths prouct.
t { // Let's create an GC allocated three-dimensional rectangular array from 2 matrices 3x4 auto matrix1 = multidimArray!int(2, 3, 4); // Let's create the same array using an existing storage auto darr2 = new int[24]; // At least 24 elements are needed auto matrix2 = multidimArray(darr2, 2, 3, 4); // No need for explicit element type declaration // Let's create the same array using an existing static array as data storage int[4][3][2] sarr3; // or in a postfix form: int sarr[2][3][4]; auto matrix3 = multidimArray(sarr3); // No need for any explicit template declarations // The head array can be dynamic int[4][3][] darr3 = sarr3[]; auto matrix31 = multidimArray(darr3); // Works like previous one // Let's create an array of static arrays ubyte[4][4][3][2] sarr4; // a postfix form: ubyte[4] sarr[2][3][4]; auto matrix4 = multidimArray!3(sarr4); // Only 3 major of 4 dimensions are indeces // The head array can also be dynamic auto matrix41 = multidimArray!3(sarr4[]); // Works like previous o
MultidimArray
Convenience function that returns an MultidimArray!(T, n) object.