Doubt - Static multidimension arrays

tsbockman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 18 20:50:18 PST 2016


On Tuesday, 19 January 2016 at 03:20:30 UTC, albert00 wrote:
> [...]

You're not really creating a rectangular array - what you're 
making is an array *of arrays*:

int[10][5] a; // An array of 5 (int[10])

writeln(typeof(a).stringof);      // int[10][5]
writeln(typeof(a[4]).stringof);    // int[10]
writeln(typeof(a[4][9]).stringof); // int

The recently accepted `std.experimental.ndslice` module provides 
a real multi-dimensional array interface:
     
http://dlang.org/phobos-prerelease/std_experimental_ndslice.html

(There might be something else relevant in Phobos as well, with a 
less numerically-oriented focus; I'm not sure.)



More information about the Digitalmars-d-learn mailing list