Range.init does not imply Range.empty==true
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Dec 20 12:48:10 PST 2012
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
More information about the Digitalmars-d
mailing list