View source code
Display the source code in std/algorithm/mutation.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.algorithm.mutation.moveAll
For each element a
in
and each element src
b
in
in lockstep in increasing order, calls tgt
.
move
(a, b)
Prototype
Range2 moveAll(Range1, Range2)( Range1 src, Range2 tgt ) if (isInputRange!Range1 && isInputRange!Range2 && is(typeof(move(src.front, tgt.front))));
Preconditions
walkLength(
.
This precondition will be asserted. If you cannot ensure there is enough room in
src
) <= walkLength(tgt
)
to accommodate all of tgt
use src
moveSome
instead.
Parameters
Name | Description |
---|---|
src | An input range with movable elements. |
tgt | An input range with
elements that elements from can be moved into. |
Returns
The leftover portion of
after all elements from tgt
have
been moved.
src
Example
int[3] a = [ 1, 2, 3 ]; int[5] b; assert(moveAll(a[], b[]) is b[3 .. $]); assert(a[] == b[0 .. 3]); int[3] cmp = [ 1, 2, 3 ]; assert(a[] == cmp[]);