A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://sgistl.github.io/reverse.html below:

reverse

reverse Prototype
template <class BidirectionalIterator>
void reverse(BidirectionalIterator first, BidirectionalIterator last);
DescriptionReverse reverses a range. That is: for every i such that 0 <= i <= (last - first) / 2), it exchanges *(first + i) and *(last - (i + 1)). Definition Defined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h. Requirements on types Preconditions Complexity Linear: reverse(first, last) makes (last - first) / 2 calls to swap. Example
vector<int> V;
V.push_back(0);
V.push_back(1);
V.push_back(2);
copy(V.begin(), V.end(), ostream_iterator<int>(cout, " "));
                // Output: 0 1 2
reverse(V.begin(), V.end());
copy(V.begin(), V.end(), ostream_iterator<int>(cout, " "));
                // Output: 2 1 0
Notes See alsoreverse_copy STL Main Page

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4