Function copy
Copies the source range into the target range.
Target copy(Source, Target)
(
Source source,
Target target
)
if (isInputRange!Source && isOutputRange!(Target, ElementType!Source));
Parameters
| Name | Description |
|---|---|
| Source | Input range type. |
| Target | Output range type. |
| source | Source input range. |
| target | Target output range. |
Returns
target range, whose front element is the one past the last element copied.
Precondition
target should be large enough to accept all source elements.
Example
import tanya .algorithm .comparison : equal;
const int[2] source = [1, 2];
int[2] target = [3, 4];
copy(source[], target[]);
assert(equal(source[], target[]));