associative arrays: iteration is finally here
bearophile
bearophileHUGS at lycos.com
Thu Oct 29 12:54:53 PDT 2009
KennyTM~:
> (Moreover, having .remove() to throw means you can't delete any
> dictionary items in nothrow functions. Sure you can silent it with
> try/catch but that's expensive.)
In nothrow functions you can use a different method, like "discard" (or a similar name less intuitive than remove), that's like remove, but it doesn't throw and just returns false when the key was absent.
The idea is to use the safer method by default and the less safe one as a performance optimization (or where you are sure you want that semantics) in the other places.
Bye,
bearophile
More information about the Digitalmars-d
mailing list