public member function
std::base
<iterator>
Return base iterator
Returns 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 regards to its base iterator).
Parameters
none
Return value
The base iterator, which iterates in the opposite direction.
Iterator is
reverse_iterator's template parameter (the type of the base iterator).
Example
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>
#include <iterator>
#include <vector>
using namespace std;
int main () {
vector<int> myvector;
for (int i=0; i<10; i++) myvector.push_back(i);
typedef vector<int>::iterator iter_int;
reverse_iterator<iter_int> rev_end (myvector.begin());
reverse_iterator<iter_int> rev_begin (myvector.end());
for (iter_int it = rev_end.base(); it < rev_begin.base(); ++it)
cout << *it << " ";
cout << endl;
return 0;
}
|
Output: