On 6/25/2011 1:57 PM, Ali Çehreli wrote:
On Sat, 25 Jun 2011 12:57:15 +0800, Nub Public wrote:

How to do this properly?

foreach (key, value; aa)
    remove(key);

This doesn't work since it's altering the aa in each iteration.

The .keys property returns an array of the keys (as a copy). This should
be safe:

     foreach (key; aa.keys) {
         aa.remove(key);
     }

Ali

Thank you.

Reply via email to