std.range.iota enhancement: supporting more types (AKA issue 10762)

Jakob Ovrum jakobovrum at gmail.com
Tue Dec 24 03:05:01 PST 2013


On Tuesday, 24 December 2013 at 10:38:17 UTC, Francesco Cattoglio 
wrote:
> The range will only be a RA range for types that implement (inc 
> * n) and ((end - begin) / step) (used for lenght computation), 
> otherwise it will be a ForwardRange, because it can't be 
> directional if we can't compute the last element in O(1).

Bidirectionality and random access are separate capabilities; the 
former can be supported without the latter through `--end`, and 
`end == start`, and we should support that. If it causes problems 
when the same range is traversed from both ends, then that is an 
issue with the UDT's operator overloads.


More information about the Digitalmars-d mailing list