(1.0) Clearing out an Associative Array

bearophile bearophileHUGS at lycos.com
Thu Jan 31 22:27:24 PST 2008


Steven Schveighoffer:
> Ha ha! jicman liked my idea better.  Jealous much?
> j/k, I like your solution better :)

Try this:

import std.stdio;
void main() {
    int[int] a = [10:20, 30:40];
    auto b = a;
    writefln(a, " ", b);
    a = null;
    writefln(a, " ", b);
}

It outputs:

[10:20,30:40] [10:20,30:40]
[] [10:20,30:40]

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list