Standard C++ Library Class Reference

Click on the banner to return to the Class Reference home page.
©Copyright 1996 Rogue Wave Software
reverse
Algorithm
Summary
Reverse the order of elements in a collection.
Contents
Synopsis
Description
Complexity
Example
Warning
See Also
Synopsis
#include <algorithm>
template <class BidirectionalIterator>
void reverse (BidirectionalIterator first,
BidirectionalIterator last);
Description
The algorithm reverse reverses the elements in a sequence so that the last element becomes the
new first element, and the first element becomes the new last. For each non-negative integer i
<= (last - first)/2 , reverse applies swap to all pairs of iterators first + I, (last - I) - 1.
Because the iterators are assumed to be bidirectional, reverse does not return anything.