Is the following code legal?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 2 08:17:54 PDT 2016


On Wednesday, 2 November 2016 at 14:21:32 UTC, Shachar Shemesh 
wrote:
> The D documentation (https://dlang.org/spec/hash-map.html) 
> leaves this not defined.

The foreach statement is defined to not allow it:

http://dlang.org/spec/statement.html#ForeachStatement

"The aggregate must be loop invariant, meaning that elements to 
the aggregate cannot be added or removed from it in the 
NoScopeNonEmptyStatement."


More information about the Digitalmars-d mailing list