template<class InputIterator, class OutputIterator>
OutputIterator copy(InputIterator first, InputIterator last,
OutputIterator result);
Requires: result shall not be in the range
[first, last). Effects: Copies elements in the range
[first, last) into the range
[result, result + (last - first)) starting from
first and proceeding to
last. For each non-negative integer
n < (last - first), performs
*(result + n) = *(first + n).Returns: result + (last - first). Complexity: Exactly
last - first assignments
. template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
ForwardIterator2 copy(ExecutionPolicy&& policy,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result);
Requires: The ranges
[first, last) and
[result, result + (last - first)) shall not overlap
. Effects: Copies elements in the range
[first, last) into
the range
[result, result + (last - first)). For each non-negative integer
n < (last - first),
performs
*(result + n) = *(first + n).Returns: result + (last - first). Complexity: Exactly
last - first assignments
. template<class InputIterator, class Size, class OutputIterator>
OutputIterator copy_n(InputIterator first, Size n,
OutputIterator result);
template<class ExecutionPolicy, class ForwardIterator1, class Size, class ForwardIterator2>
ForwardIterator2 copy_n(ExecutionPolicy&& exec,
ForwardIterator1 first, Size n,
ForwardIterator2 result);
Effects: For each non-negative integer
, performs
*(result + i) = *(first + i). Complexity: Exactly
n assignments
. template<class InputIterator, class OutputIterator, class Predicate>
OutputIterator copy_if(InputIterator first, InputIterator last,
OutputIterator result, Predicate pred);
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class Predicate>
ForwardIterator2 copy_if(ExecutionPolicy&& exec,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result, Predicate pred);
Requires: The ranges
[first, last) and
[result, result + (last - first)) shall not overlap
. [
Note: For the overload with an
ExecutionPolicy, there may be a performance
cost if
iterator_traits<ForwardIterator1>::value_type is not
MoveConstructible (Table
23)
. —
end note ]
Effects: Copies all of the elements referred to by the iterator
i in the range
[first, last)
for which
pred(*i) is
true. Returns: The end of the resulting range
. Complexity: Exactly
last - first applications of the corresponding predicate
. template<class BidirectionalIterator1, class BidirectionalIterator2>
BidirectionalIterator2
copy_backward(BidirectionalIterator1 first,
BidirectionalIterator1 last,
BidirectionalIterator2 result);
Requires:
result
shall not be in the range
(first, last]. Effects:
Copies elements in the range
[first, last)
into the
range
[result - (last-first), result)
starting from
last - 1
and proceeding to
first.
For each positive integer
n <= (last - first),
performs
*(result - n) = *(last - n).Returns:
result - (last - first). Complexity:
Exactly
last - first
assignments
.