a struct as an multidimensional array index

Ali Çehreli acehreli at yahoo.com
Sat Jun 11 20:55:51 UTC 2022


On 6/11/22 13:36, z wrote:

 > i meant with the syntax in (1), the spec's documentation appears to say
 > they are equivalent in result with `new *type*[X][Y]` form.
 >
 > (1) https://dlang.org/spec/expression#new_multidimensional (3. multiple
 > argument form)

Thank you. I see now: The values in parentheses are the lengths from the 
outermost to the innermost:

   new int[][][](5, 20, 30)

// The equivalent of int[30][20][5]

Although, I can see how it had to be that way so that when one used less 
number of lengths, the syntax always works from outer to inner in that 
new expression:

   new int[][][](5)

// The equivalent of int[][][5]

Ali



More information about the Digitalmars-d-learn mailing list