template <class T> void reverse(T* b,T* e); template <class T> void reverse_c(T* b1,T* e1,T* b2);
(1) For the copy version, the output array does not overlap the input array.
(2) For the copy version, the output array has at least as many cells as the input array.
(3) T has operator=.
These functions reverse the elements of an array. That is, for every integer i between 0 and e-b-1, location e-(i+1) will have the same value after reversal that b + i had before reversal.
template <class T> void reverse(T* b,T* e);
Reverses the array in place.
template <class T> void reverse_c(T* b1,T* e1,T* b2);
Like reverse except that the input array is preserved and the result written to a new array beginning at location b2.
If N is the size of the array, then complexity is O(N) for both versions. More precisely,
plain version
Exactly 3floor(N/2) assignments are done.
copy version
Exactly N assignments are done.
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.