Find if keys are in two dimensional associative array

Michal Minich michal.minich at gmail.com
Sun Jan 17 07:05:52 PST 2010


On Sun, 17 Jan 2010 09:11:06 -0500, bearophile wrote:

> Michal Minich:
>> float[int][char] aa;
> 
> Is something like this good for you (but I don't remember if Tuples
> define a toHash)? float[Tuple!(char, int)] aa;
> 
> Bye,
> bearophile

if I have more lookups based on int than on char like:

tmp = ch in aa;
foreach ...
	i in tmp

then I think this would be more effective than always searching by both 
values in tuple.

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


More information about the Digitalmars-d-learn mailing list