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

Source

Input range type.

Target

Output range type.

source Source

Source input range.

target Target

Target output range.

Return Value

Type: Target

target range, whose front element is the one past the last element copied.

Precondition: target should be large enough to accept all source elements.

Examples

import std.algorithm.comparison : equal;

const int[2] source = [1, 2];
int[2] target = [3, 4];

copy(source[], target[]);
assert(equal(source[], target[]));

Meta