setting array dimensions at runtime

Matthias Walter xammy at xammy.homelinux.net
Sun Dec 5 10:20:49 PST 2010


> The only thing I've been able to think of is
>
>    byte[][] a;
>    a.length = size;
>    for (int i; i < size; i++) {
>         a[i].length = size;
>    }
Well, you can do at least:

auto a = new byte[][size];
foreach (ref row; a)
  row = new byte[size];

Matthias



More information about the Digitalmars-d-learn mailing list