associative arrays: iteration is finally here
bearophile
bearophileHUGS at lycos.com
Thu Oct 29 10:14:38 PDT 2009
KennyTM~:
> Um what? aa["theKey"] = 1 doesn't fail, why should aa.remove("theKey")
> be special?
That's a different situation.
You probably meant to say: If aa["theKey"]++; doesn't fail, why should aa.remove("theKey") be special?
> void discard(K,V)(ref V[K] aa, in K key) {
> if (!aa.remove(key)) assert(false);
> }
This is stupid. Part of the point of built-in AAs is to avoid to import things. If I need to import (or worse define) that discard template in all programs where I use an AA, then I will create my own AAs and I'll just import and use them in the first place.
Bye,
bearophile
More information about the Digitalmars-d
mailing list