copy function template — Copies every item in a range
template<typename InIter, typename OutIter>
OutIter copy(InIter first, InIter last, OutIter result);
The copy
function template
copies items from [first
,
last
) to the output iterator
starting at result
. You must
ensure that the output sequence has enough room for last
- first
items. The return value is the value
of the result
iterator after
copying all the items, as shown in Figure 13-2.
The result
iterator cannot
be in the source range [first
,
last
), but other parts of the
destination range can overlap with the source.
See Example 13-2
(under generate
).