Array of array

Timon Gehr timon.gehr at gmx.ch
Mon Jan 2 14:15:02 PST 2012


On 01/02/2012 11:04 PM, RenatoL wrote:
> auto r = new int[][5];
> this is ok
>
> auto r = new int[][];
> this is not ok
> Error: new can only create structs, dynamic arrays or class objects
> , not int[][]'s
>
> why?

What would you expect the code to do?
What you are trying to achieve is similar to:

class Array(T){this(size_t length){...}}
auto r = new Array!(Array!int); // error: missing constructor argument


More information about the Digitalmars-d-learn mailing list