Clearing associative arrays

Martin Fuchs martin-fuchs at gmx.net
Tue Sep 18 00:24:54 PDT 2007


Thanks.

However your link doesn't work for me - it's using an edit action in the 
Wiki I would have to login before.
How do I register in the Wiki, I could only find a "login" link, but no 
"register" function?

"Bill Baxter" <dnewsgroup at billbaxter.com> wrote in message 
news:fcnttu$m99$1 at digitalmars.com...
> Martin Fuchs wrote:
>> Is there a direct way to clear the content of associative arrays in one 
>> step?
>> I would expect a statement like "arr.clear();", "arr.erase();" or 
>> "arr.removeall();" to do the work, but couldn't find one.
>> Instead it seams I would have to use the following wordy an inefficient 
>> approach:
>>
>>         foreach(x; arr)
>>             arr.remove(x);
>
> "arr = null" or "arr = arr.init" works.
>
> http://www.prowiki.org/wiki4d/wiki.cgi?action=edit&id=DocComments/Arrays&section=16
>
> (Check those "Comments" link pages on the doc whenever you don't see 
> something in the doc that you should be there)
>
> --bb 





More information about the Digitalmars-d mailing list