std::move_iterator

Da cppreference.com.
< cpp‎ | iterator

 
 
Biblioteca Iterator
Primitive iteratori
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
Adattatori iteratori
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
Flusso iteratori
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
Operazioni di iteratori
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)
Intervallo accesso
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::istream_iterator
Membri funzioni
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-=
Non membri funzioni
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-
 
Elemento definito nell'header <iterator>
template<class Iterator>
class move_iterator
(dal C++11)
std::move_iterator iteratore è un adattatore che si comporta esattamente come l'iteratore di fondo (che deve essere almeno un InputIterator), tranne che dereferenziazione converte il valore restituito dalla iteratore sottostante in un rvalue. Se questo iteratore viene utilizzato come un iteratore di input, l'effetto è che i valori vengono spostati da, anziché copiato da.
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.

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_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&&

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

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

[modifica]Esempio

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

Output:

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

[modifica]Vedi anche

crea un std::move_iterator di tipo derivato dalla tesi
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.

(funzione di modello)[modifica]
close