Find if keys are in two dimensional associative array

Michal Minich michal.minich at gmail.com
Sun Jan 17 10:38:38 PST 2010


On Sun, 17 Jan 2010 11:28:49 -0500, bearophile wrote:

> 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).

Why should AAs require opCmp. What if object is not logically sortable, 
(like Guid, DbConnection, ...). Equality & Hash should be enough...
Is the opCmp here to optimize lookup? Because opCmp may be quite slow, 
which may affect appending performance...


More information about the Digitalmars-d-learn mailing list