On Wednesday, February 16, 2011 13:36:54 Jonathan M Davis wrote: > On Wednesday, February 16, 2011 13:00:13 Andrej Mitrovic wrote: > > On 2/16/11, jam <gr0v3e...@gmail.com> wrote: > > > void main() > > > { > > > > > > auto a = [5,1,2,3,4,5,1]; > > > auto index = countUntil(retro(a),5); > > > writeln(a[a.length-1-index .. a.length]); > > > > > > } > > > > That works for random-access ranges. > > But I was under the impression that bidirectional ranges don't > > necessarily have a length property? > > I'm not sure. IIRC was assuming that they would and later someone pointed > out a valid case where they wouldn't. So, in the long run, they probably > won't but they may right now. > > Actually, I'll check... No. They don't require a range. They must be a > forward range and then have popBack and back in addition, but length is > not required.
Yikes. I should re-read my posts more. I meant to so that "IIRC, Andrei was assuming that they would." However, regardless of what was assumed before, bidirectional ranges do _not_ have to a length property. - Jonathan M Davis