Consider the following program:
int[int] hash;
..
foreach( key, ref value; hash ) {
if( value>12 )
hash.remove(key);
}
There is no reference in https://dlang.org/spec/hash-map.html whether this is legal or not (i.e. - removing an element from the hash while iterating it).
According to http://dlang.org/spec/statement.html#ForeachStatement, this seems forbidden (in which case it needs to be documented in the first link), but a forum discussion seemed to gravitate toward needing to allow this (as C++ does, at least since C++14).
Comment #1 by andrei — 2016-11-03T12:33:41Z
Alex, I'm passing this to you since you've already looked at AAs a bit.