reverse_iterator |
An iterator that reverses the polarity of an existing random access iterator.
#include <iterator>
template
<
class RandomAccessIterator,
class T,
class Reference,
class Distance
>
class stl_reverse_iterator : public random_access_iterator< T, Distance >
true
if the reverse iterator's associated iterator is in the same state as the
associated iterator of x .true
if the reverse iterator's associated iterator is not in the same state as
the associated iterator of x .true
if the reverse iterator's associated iterator is greater than the associated
iterator of x .
#include <iostream>
#include <iterator>
#include <vector>
int array[] = { 1, 5, 2, 3 };
void
main()
{
vector< int > v( array, array + 4 );
stl_reverse_iterator
<
vector< int >::iterator, int,
vector< int >::reference, int*,
vector< int >::difference_type
> r( v.end() );
while ( r != v.begin() )
cout << *r++ << "\n";
}
3
2
5
1
Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.