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
Saaa wrote:
So, what is the fastest way to clean an AA?
int[char] tmp;
aa = tmp;
--
Rainer Deyke - rain...@eldwood.com
On Wed, 21 Oct 2009 23:06:47 -0400, Saaa em...@needmail.com wrote:
Is there anything with removing the current key in a foreach?
foreach (K k, ; aa)
{
..
aa.remove(k);
}
Yes, behavior is undefined.
from http://digitalmars.com/d/2.0/statement.html#ForeachStatement :
The aggregate must
Steven Schveighoffer wrote:
Yes, behavior is undefined.
from http://digitalmars.com/d/2.0/statement.html#ForeachStatement :
The aggregate must be loop invariant, meaning that elements to the
aggregate cannot be added or removed from it in the [loop body]
I suspect removing the current key
On Thu, 22 Oct 2009 00:45:36 -0400, Saaa em...@needmail.com wrote:
Steven Schveighoffer wrote:
Yes, behavior is undefined.
from http://digitalmars.com/d/2.0/statement.html#ForeachStatement :
The aggregate must be loop invariant, meaning that elements to the
aggregate cannot be added or