[ Web Proxy ]
URL:
Viewing: https://fr.cppreference.com/cpp/iterator/reverse_iterator [Back]  [Original]

std::reverse_iterator cppreference.com
cppreference.com
Espaces de noms
Variantes

std::reverse_iterator

De cppreference.com
 
 
Bibliothque Iterator
Primitives Iterator
Original:
Iterator primitives
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iterator_traits
input_iterator_tag
output_iterator_tag
forward_iterator_tag
bidirectional_iterator_tag
random_access_iterator_tag
iterator
Adaptateurs Iterator
Original:
Iterator adaptors
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
reverse_iterator
Itrateurs de flux
Original:
Stream iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istream_iterator
ostream_iterator
istreambuf_iterator
ostreambuf_iterator
Oprations Iterator
Original:
Iterator operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
advance
distance
prev (C++11)
next (C++11)
Gamme d'accs
Original:
Range access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
begin (C++11)
end (C++11)
 
std::reverse_iterator
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
reverse_iterator::reverse_iterator
reverse_iterator::operator=
reverse_iterator::base
reverse_iterator::operator*
reverse_iterator::operator->
reverse_iterator::operator[]
reverse_iterator::operator++
reverse_iterator::operator+
reverse_iterator::operator+=
reverse_iterator::operator--
reverse_iterator::operator-
reverse_iterator::operator-=
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator==
operator!=
operator<
operator>
operator+
operator-
 
<tbody> </tbody>
Dclar dans l'en-tte <iterator>
template< class Iterator > class reverse_iterator : public std::iterator< typename std::iterator_traits<Iterator>::iterator_category, typename std::iterator_traits<Iterator>::value_type, typename std::iterator_traits<Iterator>::difference_type, typename std::iterator_traits<Iterator>::pointer, typename std::iterator_traits<Iterator>::reference >

std::reverse_iterator est un adaptateur d'itrateur qui inverse le sens d'un itrateur donn. En d'autres termes, lorsqu'il est fourni avec un itrateur bidirectionnel, std::reverse_iterator produit un nouvel itrateur qui se dplace depuis la fin jusqu'au dbut de la squence dfinie par l'itrateur bidirectionnel sous-jacent.

Pour un std::reverse_iterator not r construit partir d'un itrateur i, la relation &*r == &*(i-1) est toujours vraie, donc un std::reverse_iterator construit partir d'un itrateur pointant sur l'lment juste aprs la fin drfrence le dernier lment d'une squence.

C'est l'itrateur retourn par les fonctions membres rbegin() et rend() des conteneurs de la bibliothque standard.

Types de membres

Type de membre Dfinition
iterator_type Iterator
difference_type std::iterator_traits<Iterator>::difference_type
pointer std::iterator_traits<Iterator>::pointer
reference std::iterator_traits<Iterator>::reference

Fonctions membres

construit un nouvel itrateur adaptateur
Original:
constructs a new iterator adaptor
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
assigne un autre itrateur
Original:
assigns another iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
accde l'itrateur sous-jacent
Original:
accesses the underlying iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
accde l'lment point vers
Original:
accesses the pointed-to element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
obtient de rfrence rvalue l'lment index
Original:
obtains rvalue reference to indexed element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
avances ou dcrmente l'itrateur
Original:
advances or decrements the iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]

Objets membres

Nom du membre Dfinition
current (protg) une copie de l'itrateur base()

En plus de la valeur courante de l'itrateur sous-jacent, une implmentation classique de std::reverse_iterator est de garder une copie de l'itrateur sous-jacent dcrment, qui sera utilis dans le drfrencement.

Fonctions tierces

compare les itrateurs sous-jacents
Original:
compares the underlying iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction gnrique) [edit]
progrs de l'itrateur
Original:
advances the iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction gnrique) [edit]
calcule la distance entre deux adaptateurs itrateur
Original:
computes the distance between two iterator adaptors
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction gnrique) [edit]

Inherited from std::iterator

Member types

Type du membre Dfinition
value_type std::iterator_traits<Iterator>::value_type
difference_type std::iterator_traits<Iterator>::difference_type
pointer std::iterator_traits<Iterator>::pointer
reference std::iterator_traits<Iterator>::reference
iterator_category std::iterator_traits<Iterator>::iterator_category

Exemple

#include <iostream>
#include <string>
#include <iterator>

int main()
{
    std::string s = "Hello, world";
    std::reverse_iterator<std::string::iterator> r = s.rbegin();
    r[7] = 'O'; // remplace 'o' avec 'O' 
    r += 7; // l'itrateur pointe dsormais sur 'O'
    std::string rev(r, s.rend());
    std::cout << rev << '\n';
}

Rsultat :

OlleH

Voir aussi

l'itrateur de base
Original:
the basic iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe gnrique) [edit]

Web Proxy Viewer  |  New URL  |  Original Page