Is removing elements of AA in foreach loop safe?

Ferhat Kurtulmuş aferust at gmail.com
Wed Sep 4 10:50:23 UTC 2019


On Wednesday, 4 September 2019 at 06:20:00 UTC, berni wrote:
> On Tuesday, 3 September 2019 at 20:06:27 UTC, Ferhat Kurtulmuş 
> wrote:
>> I know, it is foreach loop in question. How about using a 
>> reverse for loop like:
>>
>> for (size_t i = arr.length ; i-- > 0 ; ){
>>     arr.remove(i);
>> }
>
> This would be good, if it where for slices. But with 
> associative arrays, this doesn't work. :-(

Oh, I am sorry that I missed that point.


More information about the Digitalmars-d-learn mailing list