Reuse/reset dynamic rectangular array?

9il ilyayaroshenko at gmail.com
Tue May 28 01:52:28 UTC 2019


On Saturday, 25 May 2019 at 16:17:40 UTC, Robert M. Münch wrote:
> On 2019-05-25 14:28:24 +0000, Robert M. Münch said:
>
>> How can I reset a rectangualr array without having to loop 
>> through it?
>> 
>> int[][] myRectData = new int[][](10,10);
>> 
>> myRectData.length = 0;
>> myRectData[].length = 0;		
>> myRectData[][].length = 0;	
>> 
>> They all give: slice expression .. is not a modifiable lvalue.
>
> My question was unprecise: I want to keep the first dimension 
> and only reset the arrays of the 2nd dimension. So that I can 
> append stuff again.

myRectData[] = null;


More information about the Digitalmars-d-learn mailing list