Initialization of dynamic multidimensional array
berni via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 10 01:03:16 PST 2017
On Tuesday, 7 February 2017 at 19:06:22 UTC, berni wrote:
>> auto arr = uninitializedArray!(int[][])(ROWS,COLS);
>> arr.each!"a[]=-1";
>
> This looks like what I was looking for. At least I think I
> understand what's going on here. The other two suggestions are
> beyond my scope yet, but I'll come back, when I improved on my
> D skills. Thanks for your replies.
Now I tried this with a named instead of a magic constant e.g.
> immutable VALUE=-1;
> arr.each!"a[]=VALUE";
And it doesn't work anymore. I've no clue, why... Can you help me?
More information about the Digitalmars-d-learn
mailing list