On Thu, 13 Nov 2014 07:08:17 +0000
Sergey via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

>    Hello everyone!
> 
> I need to create a two-dimensional array in this way, for example:
> 
> auto x = 10;
> auto y = 10;
> auto some_array = new string[x][y];
> variable x cannot be read at compile time
> 
> I tried this:
> enum columns_array = 
> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
> auto y = 10;
> int i = 1;
> auto some_array = new string[columns_array[i]][y];
> Error: columns_array is used as a type
> 
> And yet, if I have a function:
> string[x][] some_function (some par) {
>     auto x = 10;
>     auto y = 10;
>     auto some_array = new string[x][y];
>     return some_array;
>     }
> 
> Thanks in advance.
you can't. use static constructor.

Attachment: signature.asc
Description: PGP signature

Reply via email to