Espaços nominais
Variantes
Acções

std::move_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.
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::istream_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.
move_iterator::move_iterator
move_iterator::operator=
move_iterator::base
move_iterator::operator*
move_iterator::operator->
move_iterator::operator[]
move_iterator::operator++
move_iterator::operator+
move_iterator::operator+=
move_iterator::operator--
move_iterator::operator-
move_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 move_iterator
(desde C++11)
std::move_iterator é um adaptador iterador que se comporta exatamente como o iterador subjacente (que deve ser de pelo menos um InputIterator), exceto que dereferencing converte o valor retornado pelo iterator subjacente em um rvalue. Se este iterador é usado como um iterador de entrada, o efeito é que os valores são movidos a partir de, em vez de copiado a partir de.
Original:
std::move_iterator is an iterator adaptor which behaves exactly like the underlying iterator (which must be at least an InputIterator), except that dereferencing converts the value returned by the underlying iterator into an rvalue. If this iterator is used as an input iterator, the effect is that the values are moved from, rather than copied from.
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
pointerIterator
value_typestd::iterator_traits<Iterator>::value_type
iterator_categorystd::iterator_traits<Iterator>::iterator_category
referencevalue_type&&

[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]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]

[editar]Exemplo

#include <iostream>#include <algorithm>#include <vector>#include <iterator>#include <numeric>int main(){std::vector<std::string> v{"this", "is", "an", "example"};   std::cout<<"Old contents of the vector: ";for(auto& s : v)std::cout<<'"'<< s <<"\" ";   typedefstd::vector<std::string>::iterator iter_t;std::string concat =std::accumulate( std::move_iterator<iter_t>(v.begin()), std::move_iterator<iter_t>(v.end()), std::string());// Can be simplified with std::make_move_iterator   std::cout<<"\nConcatenated as string: "<< concat <<'\n'<<"New contents of the vector: ";for(auto& s : v)std::cout<<'"'<< s <<"\" ";std::cout<<'\n';}

Saída:

Old contents of the vector: "this" "is" "an" "example" Concatenated as string: thisisanexample New contents of the vector: "" "" "" ""

[editar]Veja também

cria um std::move_iterator do tipo inferido a partir do argumento
Original:
creates a std::move_iterator of type inferred from the argument
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]
close