foreach AA key char[] type change

bearophile bearophileHUGS at lycos.com
Sat Jun 5 17:42:43 PDT 2010


Do you know why this D2 program prints  const(char)[]  instead of  char[] ?

import std.stdio: writeln;
void main() {
    int[char[]] data = [cast(char[])"foo" : 1];
    foreach (key, val; data)
        writeln(typeid(typeof(key)));
}

Bye and thank you,
bearophile


More information about the Digitalmars-d-learn mailing list