Array operations with multidimensional arrays

Marduk via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 19 02:20:16 PST 2016


In the documentation one can learn how to do array operations 
with 1D arrays. However, this does not scale up for 2D arrays. 
For example, the following does not work:

int[2][2] a,b;
a = [[1,1],[1,1]];
b[][] = a[][]*2;


Additionally, I would like to assign 2D sub-arrays of a 3D array, 
i.e. something like the following:

int[3][2][2] a;

a[0] = [[2,2], [2,2]];


I did not understand how to use std.experimental.ndslice to do 
this. An example would be greatly appreciated.


More information about the Digitalmars-d-learn mailing list