Re: setting array dimensions at runtime

2010-12-05 Thread Jonathan M Davis
On Sunday 05 December 2010 09:41:50 u...@domain.invalid wrote: > Hello, > > I've been wondering what the easiest way is to set > the dimension of an array during runtime. > > You can't write > > byte[][] a = new byte[size][size]; > > because the compiler will give an error. The only > thing

Re: setting array dimensions at runtime

2010-12-05 Thread Nekuromento
On 2010-12-05 19:41:50 +0200, u...@domain.invalid said: Hello, I've been wondering what the easiest way is to set the dimension of an array during runtime. You can't write byte[][] a = new byte[size][size]; because the compiler will give an error. The only thing I've been able to think o

Re: setting array dimensions at runtime

2010-12-05 Thread user
On 5-12-2010 19:20, Matthias Walter wrote: 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];

Re: setting array dimensions at runtime

2010-12-05 Thread Matthias Walter
> 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

setting array dimensions at runtime

2010-12-05 Thread user
Hello, I've been wondering what the easiest way is to set the dimension of an array during runtime. You can't write byte[][] a = new byte[size][size]; because the compiler will give an error. The only thing I've been able to think of is byte[][] a; a.length = size; for (int i; i <