[phobos] Definition of Random Access Range
David Simcha
dsimcha at gmail.com
Wed Jun 23 20:22:23 PDT 2010
Should we just redefine random access ranges such that they must either
have a length or be infinite? I'm trying to improve the unit tests in
std.range in preparation for some bug fixing and consistency
improvements and I'm finding the mother lode of bugs in the process
(which I'll file or fix relatively soon). I basically made a dummy
range template, made a tuple of instantiations with every combination of
(ref, non-ref returns), (length, no length) and (input, forward,
bidirectional, random access) and tried to instantiate the higher order
ranges with every one of these that made sense. One recurring theme is
that the case of a random access range that isn't infinite and doesn't
have a length is not properly dealt with.
Since I can't imagine how a range could offer O(1) random access w/o
either knowing its length or being infinite, I suggest we just add this
requirement to the definition of a random access range and be done with
it. Counterexamples?
More information about the phobos
mailing list