Espaços nominais
Variantes
Acções

std::reverse_iterator

Da cppreference.com
< cpp‎ | iterator

 
 
Biblioteca Iterator
Primitivas iterador
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.
Adaptadores de iterador
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
Iteradores fluxo
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.
Operações iterador
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.
(C++11)
(C++11)
Variar de acesso
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.
(C++11)
(C++11)
 
std::reverse_iterator
Funções de membro
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-=
Não-membros funções
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.
 
Definido no cabeçalho <iterator>
template<class Iterator >

class reverse_iterator :publicstd::iterator<
                           typenamestd::iterator_traits<Iterator>::iterator_category,
                           typenamestd::iterator_traits<Iterator>::value_type,
                           typenamestd::iterator_traits<Iterator>::difference_type,
                           typenamestd::iterator_traits<Iterator>::pointer,

                           typenamestd::iterator_traits<Iterator>::reference>
std::reverse_iterator é um adaptador iterador que inverte a direção de um iterador determinado. Em outras palavras, quando fornecido com um iterador bidirecional, std::reverse_iterator produz um novo iterador que se move a partir do fim para o princípio da sequência definida pela iterador subjacente bidireccional.
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.
Para uma r iterador reverso construído a partir de uma i iterador, o &*r ==&*(i-1) relação é sempre verdadeiro, assim um iterador inverso construído a partir de um dereferences iterador um-passado-finais a para o último elemento de uma sequência.
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.
Este é o iterador retornado por funções de membro rbegin() e rend() dos contêineres da biblioteca padrão.
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.

Índice

[editar]Tipos de membro

Tipo de membro
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_typeIterator
difference_typestd::iterator_traits<Iterator>::difference_type
pointerstd::iterator_traits<Iterator>::pointer
referencestd::iterator_traits<Iterator>::reference

[editar]Funções de membro

constrói um novo adaptador de iterador
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.

(função pública membro)[edit]
atribui outro iterador
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.

(função pública membro)[edit]
acessa o iterador subjacente
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.

(função pública membro)[edit]
acessa o elemento apontou-a
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.

(função pública membro)[edit]
obtém rvalue referência ao elemento indexado
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.

(função pública membro)[edit]
avanços ou diminui o iterador
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.

(função pública membro)[edit]

[editar]Objetos Membros

Nome do membro
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(protegido)
uma cópia do iterador 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.
Para além do valor corrente do iterador subjacente, uma implementação típica do std::reverse_iterator contém uma cópia decrementado do iterador subjacente, que é usado em dereferencing.
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.

[editar]Não-membros funções

compara os iteradores subjacentes
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.

(modelo de função)[edit]
avança o iterador
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.

(modelo de função)[edit]
calcula a distância entre dois adaptadores iterador
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.

(modelo de função)[edit]

Herdado de std::iterator

Member types

Tipo de membro
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

[editar]Exemplo

#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';}

Saída:

OlleH

[editar]Veja também

o iterador básica
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.

(modelo de classe)[edit]
close