""Luís Marques " wrote in message
news:exmfmqftpykoaxdgl...@forum.dlang.org...
- Is it allowed for an InputRange to become empty and then not empty
again? For a finite RandomAccessRange to increase in length? E.g.:
Not by itself - if a range's empty has returned true, calling empty
repeatedly should continue to return true.
If you change it externally (ie not by using the range interface) then it
can become non-empty.
eg
int[] arr;
assert(arr.empty);
arr ~= 3;
// no longer empty, but we used a method outside the range interface to
change it.
I don't think a random number generator or some hardware device producing
more data would be a good reason to change empty - range.empty is not asking
'is there more data ready', it's asking 'are there items left to iterate
over'.
- Is it allowed to not call front? E.g.:
Yes.