won't. You seem to be looking for a function which will insert
an element
between every element in a range rather than one that joins
ranges, and I'm
not aware of any function in Phobos which will do that. There
may be a way to
get one to do what you want, but I can't think of how at the
moment.
roundRobin can be used for that. I think this is suposed to work:
auto r = roundRobin(arr, repeat(s).take(arr.length - 1));
This currently gives this error:
Error: template instance
std.range.roundRobin!(S[],Take!(Repeat!(S))) error instantiating
I think this is due to the fact that roundRobin.front has
multiple return statements, some of which return an lvalue and
some of which return an rvalue when instantiated with one range
with rvalue elements and one with lvalue elements. The return
type of roundRobin is auto ref and it seems that this becomes ref
in this case. Because I don't know exactly how auto ref is
supposed to work, I don't know whether this is a bug in DMD or in
roundRobin.front.
This works:
auto r = roundRobin(arr, repeat(s).take(arr.length - 1).array);
And so does this:
auto r2 = roundRobin(arr.map!"a", repeat(s).take(arr.length - 1));