[Issue 13654] @nogc std.algorithm.enumerate
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jan 10 09:17:53 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13654
--- Comment #1 from bearophile_hugs at eml.cc ---
A possible solution is to replace this:
auto enumerate(Enumerator = size_t, Range)(Range range, Enumerator start = 0)
if (isIntegral!Enumerator && isInputRange!Range)
...
if (overflow || result > Enumerator.max)
throw new RangeError("overflow in `start + range.length`");
}
}
...
With this:
auto enumerate(Enumerator = size_t, Range)(Range range, Enumerator start = 0)
@nogc
if (isIntegral!Enumerator && isInputRange!Range)
...
if (overflow || result > Enumerator.max) {
static immutable err = new RangeError("overflow in `start +
range.length`");
throw err;
}
}
}
...
But I don't know if immutable errors are really correct.
--
More information about the Digitalmars-d-bugs
mailing list