C++ Algorithm Function copy()
C++ Algorithm copy() function is used to copy all the elements of the container [first,last] into a different container starting from result.
first: It is an input iterator to the first element of the range, where the element itself is included in the range.
last: It is an input iterator to the last element of the range, where the element itself is not included in the range.
result: It is an output iterator to the first element of the new container in which the elements are copied.
An iterator to the last element of the new range beginning with result is returned.
newvector contains: 15 25 35 45 55 65 75
The complexity of the function is linear starting from the first element to the last one.
Some or all of the container objects are accesed.
The function throws an exception if any of the container elements throws one.