AA keys

bearophile bearophileHUGS at lycos.com
Sun Mar 16 12:15:24 PDT 2008


Can you explain this to me?
Is this yet another corner case (or bug?)?

import std.stdio: writefln;

void main() {
    int[int] aa1 = [1:2, 3:4];
    int[int] aa2 = [5:6, 7:8];
    byte[int[int]] s;
    writefln(aa1, " ", aa2); // Prints: [1:2,3:4] [5:6,7:8]

    s[aa1] = 1;
    s[aa2] = 2;
    writefln(s); // Prints: [[1:2,3:4]:2]
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list