Find if keys are in two dimensional associative array

Michal Minich michal.minich at gmail.com
Sun Jan 17 04:23:32 PST 2010


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;
}



More information about the Digitalmars-d-learn mailing list