digitalmars.D - Range.init does not imply Range.empty==true
- H. S. Teoh (15/15) Dec 20 2012 I noticed that in some places in Phobos range-related code, there's an
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
Dec 20 2012








"H. S. Teoh" <hsteoh quickfur.ath.cx>