How to clear associative array

BCS ao at pathlink.com
Fri Aug 1 09:24:11 PDT 2008


Reply to Zarathustra,

> As in subject.
> 
> Type [KeyType] array;
> 
> array[new KeyType(...)] = new Type(...);
> ...
> delete array; // error
> 

I'm not sure how array=null will interact with other references to the same 
AA. 

This should clear them as well (but is more costly).

foreach(k;array.keys)array.delete(k);




More information about the Digitalmars-d-learn mailing list