the array to scan
the starting index
the ending index
the items to replace in-between from and to
A new array without changing the contents of subject.
auto a = [ 1, 2, 3, 4 ]; auto b = a.replace(1, 3, [ 9, 9, 9 ]); assert(a == [ 1, 2, 3, 4 ]); assert(b == [ 1, 9, 9, 9, 4 ]);
std.algorithm.iteration.substitute for a lazy replace.
Replaces elements from array with indices ranging from from (inclusive) to to (exclusive) with the range stuff.