|
|
template <class *gt> void copy(T* b1,T* e1,T* b2);
(1) The output array has at least as many cells as the input array.
(2) T has operator=.
Moves the contents of every cell in the array starting at b1 into the array starting at b2.
If N is the size of the array, then complexity is O(N). Exactly N assignments are done unless b1 is equal to b2, in which case no assignments are done.
copy is the only function that allows input and output arrays to overlap; in particular, none of the "copy versions" (functions with their c suffix) allows overlap. Since copy allows the input array to be changed, the parameters b1 and e1 have type T*, rather than const T*.
Because a Block (see Block(3C++)) can always be used wherever an array is called for, Array Algorithms can also be used with Blocks. In fact, these two components were actually designed to be used together.
Array_alg(3C++) Block(3C++)