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.copy
Copies the content of source into target and returns the
remaining (unfilled) part of target.
						
				TargetRange copy(SourceRange, TargetRange)
				(
				
				  SourceRange source,
				
				  TargetRange target
				
				)
				
				if (areCopyCompatibleArrays!(SourceRange, TargetRange));
				
				
				TargetRange copy(SourceRange, TargetRange)
				(
				
				  SourceRange source,
				
				  TargetRange target
				
				)
				
				if (!areCopyCompatibleArrays!(SourceRange, TargetRange) && isInputRange!SourceRange && isOutputRange!(TargetRange, ElementType!SourceRange));
						
					
				Preconditions
target shall have enough room to accommodate
the entirety of source.
Parameters
| Name | Description | 
|---|---|
| source | an input range | 
| target | an output range | 
Returns
The unfilled part of target
Example
int[] a = [ 1, 5 ];
int[] b = [ 9, 8 ];
int[] buf = new int[](aExample
As long as the target range elements support assignment from source range elements, different types of ranges are accepted:
float[] src = [ 1.0f, 5 ];
double[] dest = new double[srcExample
To copy at most n elements from a range, you may want to use
std:
import stdExample
To copy just those elements from a range that satisfy a predicate,
use filter:
import stdExample
std can be used to achieve behavior similar to
STL's copy_backward':
import stdAuthors
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.