Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
iterator
advance
back_inserter
distance
front_inserter
inserter
iterator
iterator_traits
iterator categories:
BidirectionalIterator
ForwardIterator
InputIterator
OutputIterator
RandomAccessIterator
predefined iterators:
back_insert_iterator
front_insert_iterator
insert_iterator
istreambuf_iterator
istream_iterator
ostreambuf_iterator
ostream_iterator
reverse_iterator
reverse_iterator
reverse_iterator::reverse_iterator
member functions:
base
operator*
operator+
operator++
operator+=
operator-
operator--
operator-=
operator->
operator[]


base

public member function
Iterator base() const;

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:

0 1 2 3 4 5 6 7 8 9