AA.get() problem

bearophile bearophileHUGS at lycos.com
Tue May 3 17:24:13 PDT 2011


This gives me compilation errors, is this a bug, or is my code wrong?


import std.stdio;
void main() {
    string[char] tab = ['e': "red", 'b': "blue"];
    string r;
    foreach (c; "aba") {
        // if (c in tab) r ~= tab[c]; // OK
        r ~= tab.get(c, ""); // ERR
    }
    writeln(r);
}


Thank you, bye,
bearophile


More information about the Digitalmars-d-learn mailing list