06.05.2020 16:57, Steven Schveighoffer пишет:
```
foreach(i; 0..n) // instead of for(long i = 0; i < n;)
```
I guess that `proc` delegate cant capture `i` var of `foreach` loop so
the range violation doesn't happen.
foreach over a range of integers is lowered to an equivalent for loop,
so that was not the problem.
I was surprised but `foreach` version do not have range violation, so
there is difference between `foreach` and `for` loops. I did not try
DerivedThread at all, only suggested them to avoid var capture. I just
changed `for` by `foreach` and range violation gone. Probably this is
implementation details.