On Monday, 8 July 2013 at 22:57:17 UTC, JS wrote:
int i = 0; foreach(t; T) { string name = "Value"~((i==0) ? "" : (to!string(i))); i++; }
That increments i, both ctfe and rt.
vs int i = 0; foreach(t; T) { string name = "Value"~((i==0) ? "" : (to!string(i++))); }
This will never increment i, whether in ctfe or at runtime. The entire "(to!string(i++))" will never be executed.
vs foreach(i, t; T) { string name = "Value"~((i==0) ? "" : (to!string(i))); }
This will increment i, both in ctfe and at runtime.