25 Algorithms library [algorithms]

25.3 Mutating sequence operations [alg.modifying.operations]

25.3.10 Reverse [alg.reverse]

template<class BidirectionalIterator> void reverse(BidirectionalIterator first, BidirectionalIterator last);

Effects: For each non-negative integer i <= (last - first)/2, applies iter_swap to all pairs of iterators first + i, (last - i) - 1.

Requires: *first shall be swappable ([swappable.requirements]).

Complexity: Exactly (last - first)/2 swaps.

template<class BidirectionalIterator, class OutputIterator> OutputIterator reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);

Effects: Copies the range [first,last) to the range [result,result+(last-first)) such that for any non-negative integer i < (last - first) the following assignment takes place: *(result + (last - first) - i) = *(first + i).

Requires: The ranges [first,last) and [result,result+(last-first)) shall not overlap.

Returns: result + (last - first).

Complexity: Exactly last - first assignments.