operator+(std::reverse_iterator) - cppreference.com (original) (raw)

| Defined in header | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------- | | template< class Iter > reverse_iterator<Iter> operator+ ( typename reverse_iterator<Iter>::difference_type n, const reverse_iterator<Iter>& it ); | | (constexpr since C++17) (until C++23) | | template< class Iter > constexpr reverse_iterator<Iter> operator+ ( std::iter_difference_t<Iter> n, const reverse_iterator<Iter>& it ); | | (since C++23) |

Returns the iterator it incremented by n. In fact, the underlying iterator is decremented by n.

[edit] Parameters

n - the number of positions to increment the iterator
it - the iterator adaptor to increment

[edit] Return value

reverse_iterator<Iter>(it.base() - n)

[edit] Example

[edit] See also