"IndexType" for ranges
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 2 10:13:33 PDT 2012
On Tuesday, October 02, 2012 19:08:59 Piotr Szturmaj wrote:
> Jonathan M Davis wrote:
> > if length can be specifically ulong and the type is random access, then
> > its
> > indices will need to be ulong), so unfortunately, the situation is not so
> > simple that you can always assume size_t (even you should arguably be able
> > to).
>
> It seems that isRandomAccessRange doesn't check that opIndex parameter
> type and length() return type are the same. Do you think it should?
Definitely. It makes no sense to be able to have a length greater than you can
index (beyond the fact that the last index is length - 1), and it makes no
sense to be able to index anything greater than length as far as the size of
types go.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list