Is removing elements of AA in foreach loop safe?

berni someone at somewhere.com
Wed Sep 4 06:20:00 UTC 2019


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. :-(


More information about the Digitalmars-d-learn mailing list