Retrieving the traversed range

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Aug 25 14:39:08 PDT 2010


On 8/25/10 14:09 PDT, Simen kjaeraas wrote:
> 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?

Your memory is accurate. I opted for going with the simplest interface 
and add stuff only if need arises later. Well, now seems to be later :o).

Andrei


More information about the Digitalmars-d mailing list