Espaços nominais
Variantes
Acções

std::make_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.
make_move_iterator
(C++11)
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)
 
Definido no cabeçalho <iterator>
template<class Iterator >
std::move_iterator<Iterator> make_move_iterator(const Iterator& i );
(desde C++11)
make_move_iterator é um modelo de função de conveniência que constrói uma std::move_iterator para o i iterador determinado com o tipo de deduzida a partir do tipo do argumento.
Original:
make_move_iterator is a convenience function template that constructs a std::move_iterator for the given iterator i with the type deduced from the type of the argument.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar]Parâmetros

i -
iterador de entrada a serem convertidos para mover iterador
Original:
input iterator to be converted to move iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Valor de retorno

A std::move_iterator que pode ser usado para mover os elementos de acedidos através i
Original:
A std::move_iterator which can be used to move from the elements accessed through i
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Possível implementação

template<class Iterator >std::move_iterator<Container> make_move_iterator(const Iterator& i){returnstd::move_iterator<Iterator>(i);}

[editar]Exemplo

#include <iostream>#include <list>#include <vector>#include <string>#include <iterator>int main(){std::list<std::string> s{"one", "two", "three"};   std::vector<std::string> v1(s.begin(), s.end());// copy   std::vector<std::string> v2(std::make_move_iterator(s.begin()), std::make_move_iterator(s.end()));// move   std::cout<<"v1 now holds: ";for(auto str : v1)std::cout<<"\""<< str <<"\" ";std::cout<<"\nv2 now holds: ";for(auto str : v2)std::cout<<"\""<< str <<"\" ";std::cout<<"\noriginal list now holds: ";for(auto str : s)std::cout<<"\""<< str <<"\" ";std::cout<<'\n';}

Saída:

v1 now holds: "one" "two" "three" v2 now holds: "one" "two" "three" original list now holds: "" "" ""

[editar]Veja também

adaptador iterador que dereferences a uma referência de rvalue
Original:
iterator adaptor which dereferences to an rvalue reference
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]
(C++11)
obtém uma referência rvalue
Original:
obtains an rvalue reference
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