Scoped in a foreach loop.

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 4 20:07:52 PDT 2015


I tried something like this:

foreach(e; scoped!SomeRangeType(args)) {
}

And my program segment faults. But this works:

{
     auto x = scoped!SomeRangeType(args);
     foreach(e; x) {
     }
}

Shouldn't the range be alive until the end of the loop?


More information about the Digitalmars-d mailing list