public member function
<iterator>
std::reverse_iterator::baseiterator_type base() const;
Return base iterator
Returns a copy of the base iterator.The base iterator is an iterator of the same type as the one used to construct the reverse_iterator, but pointing to the element next to the one the reverse_iterator is currently pointing to (a reverse_iterator has always an offset of -1
with respect to its base iterator).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// reverse_iterator::base example
#include <iostream> // std::cout
#include <iterator> // std::reverse_iterator
#include <vector> // std::vector
int main () {
std::vector<int> myvector;
for (int i=0; i<10; i++) myvector.push_back(i);
typedef std::vector<int>::iterator iter_type;
std::reverse_iterator<iter_type> rev_end (myvector.begin());
std::reverse_iterator<iter_type> rev_begin (myvector.end());
std::cout << "myvector:";
for (iter_type it = rev_end.base(); it != rev_begin.base(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}
myvector: 0 1 2 3 4 5 6 7 8 9
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