DMD 0.167 release
Knud Sørensen
12tkvvb02 at sneakemail.com
Tue Sep 19 18:44:03 PDT 2006
On Mon, 18 Sep 2006 14:02:22 -0700, Walter Bright wrote:
> clayasaurus wrote:
>> Alright, is this feature supposed to work with multi-dimensional arrays
>> as well? like...
>>
>> bob[][] = [[2,3], [4,2], [2,0]];
>>
>> I get 'invalid conversion from int[2][3] to int[][]'
>
> Since T[n] and T[] are different types, one gets picked. But you can do:
>
> int[][] bob = [ cast(int[])[2,3], [4,2], [2,0] ];
>
> as the element type of the array is determined by the type of the first
> element.
Is it possible to let it initial number of ['s decide the dimension
[1, -> int[]
[[2, -> int[][]
[[[3u, -> uint[][][]
etc.
So, that we don't the ugly cast.
More information about the Digitalmars-d-announce
mailing list