Initialising multidimensional dynamic arrays

Mike James via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 30 09:40:37 PDT 2014


On Tuesday, 30 September 2014 at 16:07:28 UTC, ketmar via 
Digitalmars-d-learn wrote:
> On Tue, 30 Sep 2014 15:57:57 +0000
> Mike James via Digitalmars-d-learn 
> <digitalmars-d-learn at puremagic.com>
> wrote:
>
>> How do I initialise a dynamic array of dynamic arrays?
> do you mean something like this: `int[][] a`? if yes, do this:
>
>   auto a = new int[][](42, 69);
>
> and you'll get `int[42][69] a`.
>
> heh, people again confused by `new Type[amount]` syntax. that is
> concrete sign that this syntax will live forever.

Thanks ketmar,

You'll notice that it's actually a dynamic array of structs 
containing dynamic arrays - does this change your initializing?

Regards, -=mike=-


More information about the Digitalmars-d-learn mailing list