efficient and safe way to iterate on associative array?

JR via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 4 07:09:36 PST 2016


On Friday, 4 March 2016 at 14:16:55 UTC, Minas Mina wrote:
> On Friday, 4 March 2016 at 13:53:22 UTC, aki wrote:
> I think what you can do is extract its contents to an array, 
> iterate it and modify it as you like, and then insert back to 
> another associative array. I don't think it's efficient but I 
> don't know if it's possible to do something else.

You can populate an array of key values (here string, so 
string[]) of the entries to delete, then iterate through it 
afterwards and call .remove to clean up.

http://dpaste.dzfl.pl/b63a8e8e5c3b


More information about the Digitalmars-d-learn mailing list