reverse_iterator::pointer
Un type qui fournit un pointeur vers un élément a traité par reverse_iterator.
typedef typename iterator_traits<RandomIterator>::pointer pointer;
Notes
Le type est un synonyme pour le <randomiterator >::pointerd' iterator_traitsde typename de fonctionnalités d'itérateur.
Exemple
// reverse_iterator_pointer.cpp
// compile with: /EHsc
#include <iterator>
#include <algorithm>
#include <vector>
#include <utility>
#include <iostream>
int main( )
{
using namespace std;
typedef vector<pair<int,int> > pVector;
pVector vec;
vec.push_back( pVector::value_type( 1,2 ) );
vec.push_back( pVector::value_type( 3,4 ) );
vec.push_back( pVector::value_type( 5,6 ) );
pVector::iterator pvIter;
cout << "The vector vec of integer pairs is:\n" << "( ";
for ( pvIter = vec.begin ( ) ; pvIter != vec.end ( ); pvIter++)
cout << "( " << pvIter -> first << ", " << pvIter -> second << ") ";
cout << ")" << endl;
pVector::reverse_iterator rpvIter;
cout << "\nThe vector vec reversed is:\n" << "( ";
for ( rpvIter = vec.rbegin( ) ; rpvIter != vec.rend( ); rpvIter++)
cout << "( " << rpvIter -> first << ", " << rpvIter -> second << ") ";
cout << ")" << endl;
pVector::iterator pos = vec.begin ( );
pos++;
cout << "\nThe iterator pos points to:\n"
<< "( " << pos -> first << ", "
<< pos -> second << " )" << endl;
pVector::reverse_iterator rpos (pos);
cout << "\nThe iterator rpos points to:\n"
<< "( " << rpos -> first << ", "
<< rpos -> second << " )" << endl;
}
Configuration requise
en-tête : <iterator>
l'espace de noms : DST