How to re-initialise an associative array.
Daniel Davidson
nospam at spam.com
Wed Nov 6 08:34:11 PST 2013
On Wednesday, 6 November 2013 at 16:15:36 UTC, Gary Willoughby
wrote:
> A simple request but i'm failing hard. How do i re-init an
> associative array? This is obviously not the way:
>
> import std.stdio;
>
> void main(string[] args)
> {
> int[string] x;
>
> x["hello"] = 1;
> x["world"] = 2;
>
> writefln("%s", x);
>
> x = new int[string];
>
> writefln("%s", x); // Should be empty.
> }
x.clear();
More information about the Digitalmars-d-learn
mailing list