December 20, 2012 Range.init does not imply Range.empty==true | ||||
---|---|---|---|---|
| ||||
I noticed that in some places in Phobos range-related code, there's an assumption that the following code works:
auto someRangeFunction(R)(R range) {
...
R helperRange = range;
...
helperRange = R.init;
assert(helperRange.empty);
...
}
Exercise for the reader: spot the bug.
Hint: what if R is an InputRangeObject?
T
--
Which is worse: ignorance or apathy? Who knows? Who cares? -- Erich Schubert
|
Copyright © 1999-2021 by the D Language Foundation