Retrieving the traversed range

Simen kjaeraas simen.kjaras at gmail.com
Wed Aug 25 14:09:11 PDT 2010


Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:

> This is an annoying limitation of bidirectional ranges that we don't  
> have a solid solution to. Let me put on the table the unacceptable  
> solution as a baseline:
>
> auto n = walkLength(r) - walkLength(until!pred(r));
> popBackN(r, n);
> reverse(r);
>
> Of all ranges, bidirectional ranges suffer of this limitation because  
> they clearly have two underlying "ends" that are inaccessible in  
> separation from the range.

I seem to recall one of the original range RFCs you suggested some set
functions be applicable on (some) ranges, and as such
Range.allBefore( Range ) and its ilk should be possible. Was this
rejected, or is it merely my memory being adjusted by cosmic rays?

-- 
Simen


More information about the Digitalmars-d mailing list