This is for the variant of joiner that takes a separator.
Restructure algorithm to not call .popFront while we're still using
.front.
Make sure we .save subranges when we're exporting .save, since RoR.save
does not guarantee the state of subranges are also .save'd.
Basically, makes it stop searching as soon as an element as matched.
This is an important optimization, that avoids a lot of startsWith's other "non-optimzations"...
* Consolidate implementation by checking length in a single spot.
* Checks narrow string or the same types' lengths.
* Index iterates on all RA ranges (and not just Arrays).
Ends with was left untouched, because it forwards to startsWith anyways.
We cannot assume that RoR.save will also .save the state of its
subranges; so the only way we can correctly export a .save method in the
joined range is if we also .save its subranges as we traverse over them.
import std.algorithm;
import std.range;
void main()
{
auto N2 = sequence!"n"(cast(size_t)1).map!"a";
}
ceased to compile, because Map's opSlice won't work anymore over
infinite ranges, because the result can't be reassigned to the original.
What's the point of having all these powerful, generic, abstract functions if we're just going to copy and paste code? :-)
This change has several benefits:
* It is far more elegant.
* Changes (optimisations) to startsWith automatically carry across to endsWith.
* We get extra testing for startsWith and retro for free.
Previously endsWith constraints only required input ranges, but the algorithm uses `back` and `popBack` within, so clearly a bidirectional range is needed.
This reverts commit 07104b5fe6.
As we cannot currenly rely on even ranges with slicing implementing
opDollar, this change breaks code, because it assumes that such ranges
implement opDollar.
- I assume they are not properties, then changed to normal functions.
- Global .moveFront/Back uses front and back if member moveFront/back doesn't exist.
Then, member aliases are just redundant.
find should work with multiple needles which are a combination of
elements and ranges rather than just all ranges - just like startsWith
and endsWith do - and since that overload of find calls startsWith, it's
trivial to make it take the same types of arguments as startsWith.