Find if keys are in two dimensional associative array

Jesse Phillips jessekphillips+D at gmail.com
Mon Jan 18 22:05:00 PST 2010


Michal Minich wrote:

> if one has double indexed aa, how to find that it contains value under 
> keys 'a' and 123
>
> float[int][char] aa;
>
> aa['a'][123] = 4.56;
>
> I had to make following helper function. Is there more elegant way / 
> built in into D?
>
> float* isIn = doubleIn(123, 'a');
>
> float* doubleIn (int i, char ch) {
>
>     float[int]* first = ch in aa;
>
>     if (first is null)
>         return null;
>     else
>         return i in *first;
> }

Don't know if this would have any affect on what you want, but there is
this bugzilla: "Associative array of associative arrays gets confused"

http://d.puremagic.com/issues/show_bug.cgi?id=3709


More information about the Digitalmars-d-learn mailing list