Modifying Algorithms
C++ has many algorithms to modify elements and ranges.
Copy Elements and Ranges
You can copy ranges forward with std::copy
, backward with std::copy_backward
and conditionally with std::copy_if
. If you want to copy n elements, you can use std::copy_n
.
Copies the range:
Copies n elements:
Copies the elements dependent on the predicate pre
.
Copies the range backward:
The algorithms need input iterators and copy their elements to result
. They return an end iterator to the destination range.