Assigning to slice of array

Jamie jamieborder01 at gmail.com
Thu Mar 1 23:51:37 UTC 2018


On Thursday, 1 March 2018 at 23:17:11 UTC, Jonathan M Davis wrote:
> So, something like
>
> auto arr = new int[][][](3, 2, 1);
> arr.length = 4;
> arr[0].length = 5;
> arr[0][0].length = 6;
>
> is legal, but something like

Thanks Jonathan, this is exactly what I was looking for. I was 
getting confused with not being able to resize because I was 
looking at int[] arrays and I guess the way I was defining them 
caused them both to be dynamic (when I thought one was static).

On a similar not, is there an accepted way to assign across 
arrays? As Steve mentioned, cross-slicing isn't supported, so is 
the best way to iterate through the array and assign as necessary?
Thanks, Jamie







More information about the Digitalmars-d-learn mailing list