clear AAs
Aarti_pl
aarti at interia.pl
Wed Apr 18 01:34:12 PDT 2007
Bradley Smith napisał(a):
> Mandel wrote:
>> Hi,
>>
>> I have a simple question, how can I remove all elements of an
>> associative array
>> in an elegant way?
>> The length property of an AA is read only.
>> Doing a foreach/remove seems a bit to much text; most containers
>> provide some clear method.
>
>
> import std.stdio;
>
> void main() {
>
> bool[char[]] aa;
> aa["abc"] = true;
> aa["def"] = false;
> writefln(aa);
>
> aa = aa.init;
> writefln(aa);
> }
>
You can also do it in following way:
aa = null;
BR
Marcin Kuszczak
aarti_pl
More information about the Digitalmars-d-learn
mailing list