On 8/29/17 8:50 AM, Robert M. Münch wrote:
Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1
I haven't read everything, so not sure if it worth to take a look.
Interesting. It reminds me a bit of cursors for dcollections. In there,
a cursor is a 0 or 1 element range. The one element range points at an
element, the 0 element range points at a border. You can use cursors to
compose ranges.
https://github.com/schveiguy/dcollections
Not sure how useful it is to have them be separate types. It can be nice
I suppose. But one thing I love about iterators/cursors is that
something like find doesn't assume what data you are interested in.
In Phobos, find gives you a range where the first element is the one you
searched for, and the last element is the end of the original range. But
what if you wanted all the data *up to* the element instead? What if you
just wanted to look at that specific element? So we need several
functions that do this, and it's not always clear how to do it
correctly, and it's difficult to compose one function from the other.
With iterators, it's simple.
-Steve