##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::reverse_iterator::base

From cppreference.com
< cpp‎ | iterator‎ | reverse iterator

Iterator base() const; |  |

Returns the underlying base iterator.

The base iterator refers to the element that is next to the element the `reverse_iterator` is currently pointing to. That is std::reverse_iterator(it).base() == std::next(it).

### [edit] Parameters

(none)

### [edit] Return value

The underlying iterator.

### [edit] Exceptions

(none)

### [edit] Example

Run this code

    #include <iostream>
    #include <iterator>
    #include <vector>

    int main()
    {
        std::vector<int> v = { 0, 1, 2, 3, 4, 5 };

        using RevIt = std::reverse_iterator<std::vector<int>::iterator>;
        RevIt r_end(v.begin());
        RevIt r_begin(v.end());

        for (auto it = r_end.base(); it != r_begin.base(); ++it) {
            std::cout << *it << " ";
        }
        std::cout << "\n";
    }

Output:

    0 1 2 3 4 5

### [edit] See also

operator*operator-> | accesses the pointed-to element (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/iterator/reverse_iterator/base&oldid=62324"