On Fri, 03 Dec 2010 08:59:52 -0500, Steven Schveighoffer wrote: > On Fri, 03 Dec 2010 08:13:50 -0500, Lars T. Kyllingstad > <[email protected]> wrote: >> Another thing to consider is that by having opIndex() in there, your >> string satisfies isRandomAccessRange. Then, some algorithms which work >> with both bidirectional and random access may choose to go with the >> latter. This is a quote from the std.algorithm.find() docs: >> >> Specializations taking advantage of bidirectional or random access >> (where present) may accelerate search [...] > > I just looked it up, isRandomAccess requires hasLength, which my string > type does not. So my string type is not a true random access range > (this was intentional).
Ah, you are right. I didn't read the documentation for isRandomAccessRange, I just looked at the accompanying code snippet, which doesn't mention hasLength. -Lars
