September 04, 2019 Re: Is removing elements of AA in foreach loop safe? | ||||
---|---|---|---|---|
| ||||
Posted in reply to berni | 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.
|
Copyright © 1999-2021 by the D Language Foundation