View source code
Display the source code in std/algorithm/mutation.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
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.
Function std.algorithm.mutation.moveAll
Calls move(a, b)
for each element a
in src
and the corresponding
element b
in tgt
, in increasing order.
InputRange2 moveAll(InputRange1, InputRange2)
(
InputRange1 src,
InputRange2 tgt
)
if (isInputRange!InputRange1 && isInputRange!InputRange2 && is(typeof(move(src .front, tgt .front))));
Preconditions
walkLength(src) <= walkLength(tgt)
.
This precondition will be asserted. If you cannot ensure there is enough room in
tgt
to accommodate all of src
use moveSome
instead.
Parameters
Name | Description |
---|---|
src | An input range with movable elements. |
tgt | An input range with
elements that elements from src can be moved into. |
Returns
The leftover portion of tgt
after all elements from src
have
been moved.
Example
int[3] a = [ 1, 2, 3 ];
int[5] b;
assert(moveAll(a[], b[]) is b[3 .. $]);
writeln(a[]); // b[0 .. 3]
int[3] cmp = [ 1, 2, 3 ];
writeln(a[]); // cmp[]
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.