View source code
Display the source code in std/algorithm/mutation.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla 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 usinglocal clone.
Function std.algorithm.mutation.moveSome
Calls move(a, b)
for each element a
in src
and the corresponding
element b
in tgt
, in increasing order, stopping when either range has been
exhausted.
Tuple!(InputRange1,InputRange2) moveSome(InputRange1, InputRange2)(
InputRange1 src,
InputRange2 tgt
)
if (isInputRange!InputRange1 && isInputRange!InputRange2 && is(typeof(move(src .front, tgt .front))));
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 portions of the two ranges after one or the other of the ranges have been exhausted.
Example
int[5] a = [ 1, 2, 3, 4, 5 ];
int[3] b;
assert(moveSome(a[], b[])[0] is a[3 .. $]);
writeln(a[0 .. 3]); // b
writeln(a); // [1, 2, 3, 4, 5]
Authors
License
Copyright © 1999-2025 by the D Language Foundation | Page generated by ddox.