RFC on range design for D2
Sergey Gromov
snake.scaly at gmail.com
Wed Sep 10 07:28:37 PDT 2008
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> Sergey Gromov wrote:
> > - the union operations look... weird. Unobvious. I'm too sleepy now to
> > propose anything better but I'll definitely give it a try. The rest of
> > the interface seems very natural.
>
> I agree I hadn't known what primitives would be needed when I sat down.
> Clearly there was a need for some since individual iterators are not
> available anymore. New ideas would be great; I suggest you validate them
> by implementing some nontrivial algorithms in std.algorithm with your,
> um, computational basis of choice :o).
r.before(s)
r.after(s)
r.begin
r.end
Here r.before(s) is everything from the r's first element (inclusive) to
the first s's element (exclusive); r.after(s) is from last s's element
(exclusive) to the last element of r (inclusive); r.begin is an empty
range at the beginning of a parent range; and r.end is an empty range at
the end of a parent range. Therefore, according to your diagram:
r.toBegin(s) => r.before(s)
s.toEnd(r) => s.before(r.end)
s.fromEnd(r) => s.after(r)
More information about the Digitalmars-d-announce
mailing list