On Thu, 22 Oct 2009 02:59:13 -0400, Saaa <em...@needmail.com> wrote:
Saaa wrote:
Steven Schveighoffer wrote
But I've changed everything to `new` the array afterwards as I deleted
all the
keys anyways.
Not sure what you mean here.
foreach (K k, ; aa)
{
..
//aa.remove(k);
}
aa = new int[char];
Error: new can only create structs, dynamic arrays or class objects
So, what is the fastest way to clean an AA?
aa = null;
However, if you have multiple copies of the AA, this does not clear out
the data. It merely resets the AA reference.
I'd not trust your code because it's undefined behavior. If you want to
remove all the elements individually, copy the keys to an array, then
iterate over the array removing each element.
Or use a real collection class, such as Tango's or dcollections' and use
the clear() method :)
-Steve