Question: The C++ std copy template is implemented this way: template Iterator2 copy (Iterator1 start, Iterator1 stop, Iterator2 result) { while (start ! = stop) {

The C++ std copy template is implemented this way: template Iterator2 copy (Iterator1 start, Iterator1 stop, Iterator2 result) { while (start ! = stop) { *"result = *start: ++start: ++result: } return result: } Suppose that we want to use copy this way: Container c1: Container c2: copy (c1.begin), c1.end(), c2.begin()): Which of the following conditions is required if the copy is to work properly? Iterator1 must have a copy constructor container must provide both const and non-const iterators c2 must already contain at least as many elements as c1 Element must have an assignment operator Element must have a copy constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
