Espacios de nombres
Variantes
Acciones

std::move_iterator

De 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 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 Stream
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.
Operaciones 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)
Rango de acceso
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
Las funciones miembro
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.
Terceros funciones
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 en la cabecera <iterator>
template <class Iterator>
class move_iterator
(desde C++11)
std::move_iterator iterador es un adaptador que se comporta exactamente igual que el iterador subyacente (que debe ser de al menos un InputIterator), excepto que desreferencia convierte el valor devuelto por el iterador subyacente en un valor p. Si este iterador se utiliza como un iterador de entrada, el efecto es que los valores se desplazan de, en lugar de copiado 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.

Contenido

[editar] Tipos de miembros

Miembro de 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 Iterator
value_type std::iterator_traits<Iterator>::value_type
iterator_category std::iterator_traits<Iterator>::iterator_category
reference value_type&&

[editar] Las funciones miembro

construye un nuevo adaptador 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.

(función miembro público) [editar]
asigna otro 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.

(función miembro público) [editar]
accede el iterador subyacente
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.

(función miembro público) [editar]
accede al elemento en punta-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.

(función miembro público) [editar]
obtiene rvalue referencia al 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.

(función miembro público) [editar]
avances o disminuye el 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.

(función miembro público) [editar]

[editar] Terceros funciones

compara los iteradores subyacentes
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.

(plantilla de función) [editar]
avanza el 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.

(plantilla de función) [editar]
calcula la distancia entre dos 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.

(plantilla de función) [editar]

[editar] Ejemplo

#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 << "\" ";
 
    typedef std::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';
}

Salida:

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

[editar] Ver también

crea una std::move_iterator de tipo inferido a partir de la discusión
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.

(plantilla de función) [editar]