Find if keys are in two dimensional associative array

bearophile bearophileHUGS at lycos.com
Sun Jan 17 08:28:49 PST 2010


Michal Minich:
> Anyway the tuple is struct. I think struct equality is defined by 
> equality of all fields, then it should work in AA...

In D the built in AAs require an equality test and/or cmp, plus opHash. (The collisions are resolved with an ordered search tree (maybe AVL, I don't remember, probably not a ternary tree)). Normal structs don't define all that. I don't remember if Tuple of D2 define all that. See the docs. (My Record struct can be used just fine as AA keys).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list