Array of array

Timon Gehr timon.gehr at gmx.ch
Mon Jan 2 14:33:43 PST 2012


On 01/02/2012 11:21 PM, RenatoL wrote:
> Just curious... the answer of the compiler it's a bit unclear to
> me...
>
> T[] is a dynamic array of type T.
> T[][] is a dynamic array of T[]. But this doesn't work. Why?

It does work. Why do you think it does not?

T[] a;               // ok
T[][] b;             // ok
auto c = new T[5];   // ok
auto d = new T[][5]; // ok
auto e = new T[];    // fail, nonsensical
auto f = new T[][];  // fail, nonsensical



More information about the Digitalmars-d-learn mailing list