I've been enjoying my time with D's ranges, but something is
nagging at me: If the range is not random access, then how does
one create a sub-view of that range?
Say I have a forward range (for example, an SList[]). I would
like to create a new range containing only the first 5 elements
of that old range. How can I do that?
I see no logical reason that prevents me from doing it, since C++
iterators can do it quite fine. (the C++ algorithms that work
only on RA ranges is mostly for efficiency reasons). Not being
able to do this would severely limit the amount of containers
that can seamlessly merge with algorithms.
For example, I can't call splitter on an SList. Not sure if this
is just "not currently supported", or just not possible...
Any thoughts?
- Creating a Sub-view of a non - RA (hasSlicing) range. monarch_dodra
-