Safe Cursors and Ranges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Aug 26 10:37:13 PDT 2010


On 8/26/10 7:18 PDT, Pillsy wrote:
[snip]
>       Range before ();
>
>       Range after ();

(I wrote my last post before reading yours.) Excellent points. I do 
think we can get away without defining a new type. In addition to the 
allBefore(all, tail) primitive (which is easy to implement as a safe 
primitive by ranges that support it) we could also define allAfter(all, 
head) that works when head is superimposed over the beginning portion of 
all (is a prefix of it).

It would still be impossible to take a range somewhere in the middle of 
another and then get in constant time the portion before and after it, 
but (a) that is difficult to make safe in O(1) anyway, and (b) there is 
exceedingly rare need for it.

Andrei


More information about the Digitalmars-d mailing list