multi-dimensional dynamic arrays

Jay Norwood via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 19 05:53:58 PST 2016


On Friday, 19 February 2016 at 07:59:29 UTC, Jonathan M Davis 
wrote:
> .. Or you could do something really wonky like
>
>     auto arr = new int[][2][](5);
>
> which would be a dynamic array of length 5 which holds static 
> arrays of length 2 which hold dynamic arrays which are null.

In my case, int [1][][1] ub;, there is only one dynamic 
dimension, but if I try to use .length to change the length,  
ub.length = 3, the compiler doesn't like that.


	int[1][][1] ubb;
	ubb.length = 3;
src\app.d(13,5): Error: constant ubb.length is not an lvalue
dmd failed with exit code 1.


So, is there some supported syntax to set the length of the 
internal dimension, or to append to it?



More information about the Digitalmars-d-learn mailing list