Length of Dimension in Multidimensional Array?
    Steven Schveighoffer via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Jun  5 06:06:46 PDT 2015
    
    
  
On 6/5/15 3:53 AM, Ralf the Bat wrote:
> Probably a stupid question, but how do I find the length of each
> dimension in a multidimensional array?
if you mean a static array, you can get each dimension using .length:
int[2][3] arr;
static assert(arr.length == 3);
static assert(arr[0].length == 2);
There is likely a way you can get a tuple of the lengths at compile time.
If you mean a dynamic multidim array, each array element can have its 
own independent set of dimensions.
-Steve
    
    
More information about the Digitalmars-d-learn
mailing list