Empty array and AA literals
anonymous
anonymous at example.com
Sun Apr 6 02:55:02 PDT 2014
On Sunday, 6 April 2014 at 09:41:10 UTC, bearophile wrote:
> dnspies:
>
>> What about if I have a 2D array (ie int[][]) and I want to
>> append an empty int[] on the end? Will this work?
>>
>> int[][] nested;
[...]
>
> You can increase by one of the length of the outer array, or
> you can append an empty one:
[...]
> nested ~= [];
That doesn't add an element. [] is interpreted to be an empty
int[][]. You need to write [[]] which is an int[][] holding one
empty int[].
More information about the Digitalmars-d-learn
mailing list