std::reverse_iterator
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <iterator> | ||
template<class Iterator > class reverse_iterator :publicstd::iterator< | ||
std::reverse_iterator
iteratore è un adattatore che inverte la direzione di un iteratore dato. In altre parole, quando viene fornito un iteratore bidirezionale, std::reverse_iterator
produce un nuovo iteratore che muove dalla fine all'inizio della sequenza definita dalla sottostante iteratore bidirezionale.Original:
std::reverse_iterator
is an iterator adaptor that reverses the direction of a given iterator. In other words, when provided with a bidirectional iterator, std::reverse_iterator
produces a new iterator that moves from the end to the beginning of the sequence defined by the underlying bidirectional iterator.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Per un
r
iteratore inverso costruito da un i
iteratore, il &*r ==&*(i-1) relazione è sempre vero, quindi un iteratore inverso costruito da un dereferenziazioni iteratore di un past-the-end per l'ultimo elemento di una sequenza. Original:
For a reverse iterator
r
constructed from an iterator i
, the relationship &*r ==&*(i-1) is always true; thus a reverse iterator constructed from a one-past-the-end iterator dereferences to the last element in a sequence. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Questo è l'iteratore restituito da funzioni membro
rbegin()
e rend()
dei contenitori della libreria standard.Original:
This is the iterator returned by member functions
rbegin()
and rend()
of the standard library containers.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica]Membri tipi
Membro tipo Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | Definition |
iterator_type | Iterator |
difference_type | std::iterator_traits<Iterator>::difference_type |
pointer | std::iterator_traits<Iterator>::pointer |
reference | std::iterator_traits<Iterator>::reference |
[modifica]Membri funzioni
costruisce un nuovo adattatore iteratore 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. (metodo pubblico) | |
assegna un altro iteratore 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. (metodo pubblico) | |
accede l'iteratore sottostante 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. (metodo pubblico) | |
accede alla punta-all'elemento 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. (metodo pubblico) | |
ottiene rvalue riferimento all'elemento indicizzati 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. (metodo pubblico) | |
anticipi o decrementa l'iteratore 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. (metodo pubblico) |
[modifica]Membri oggetti
Persona Original: Member name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | Definition |
current (protetto) | una copia del iteratore base () Original: a copy of the base() iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Oltre al valore corrente del iteratore sottostante, una tipica implementazione di
std::reverse_iterator
contiene una copia decrementato dell'iteratore sottostante, che è usato in dereferenziazione.Original:
In addition to the current value of the underlying iterator, a typical implementation of
std::reverse_iterator
holds a decremented copy of the underlying iterator, which is used in dereferencing.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica]Non membri funzioni
confronta i iteratori sottostanti 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. (funzione di modello) | |
avanza l'iteratore 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. (funzione di modello) | |
calcola la distanza tra due schede di iteratore 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. (funzione di modello) |
Inherited from std::iterator
Member types
Membro tipo Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | Definition |
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 |
[modifica]Esempio
#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';// replaces 'o' with 'O' r +=7;// iterator now points at 'O'std::string rev(r, s.rend());std::cout<< rev <<'\n';}
Output:
OlleH
[modifica]Vedi anche
l'iteratore di 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 template) |