Could someone explain to me, why following code does not compile?

int main()
{
        string[string] x = [ "foo" : "bar" ];
        x.clear();
        x = [];

        return 0;
}

Errors:
main.d(7): Error: no property 'clear' for type 'string[string]'
main.d(8): Error: cannot implicitly convert expression ([]) of type void[] to string[string]
Failed: ["dmd", "-v", "-o-", "main.d", "-I."]

If above doesn't work how am I supposed to clear the array? `x = string[string].init;` is somewhat ugly.

dmd --version
DMD64 D Compiler v2.070.0
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright

Reply via email to