Espacios de nombres
Variantes
Acciones

std::istream_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.
iterator_traits
input_iterator_tag
output_iterator_tag
forward_iterator_tag
bidirectional_iterator_tag
random_access_iterator_tag
iterator
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.
reverse_iterator
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.
istream_iterator
ostream_iterator
istreambuf_iterator
ostreambuf_iterator
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.
advance
distance
prev(C++11)
next(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.
begin(C++11)
end(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.
istream_iterator::istream_iterator
istream_iterator::operator*
istream_iterator::operator->
istream_iterator::operator++
istream_iterator::operator++(int)
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.
operator==
operator!=
 
Defined in header <iterator>
template< class T,

          class CharT = char,
          class Traits = std::char_traits<CharT>,
          class Distance = std::ptrdiff_t >
class istream_iterator: public std::iterator<std::input_iterator_tag,

                                             T, Distance, const T*, const T&>
std::istream_iterator es un iterador de entrada de un solo paso que lee objetos sucesivos de T tipo del objeto std::basic_istream para la que fue construido, mediante una llamada al operator>> apropiado. La operación de lectura real se realiza cuando el iterador no se incrementa, cuando se eliminan las referencias. El primer objeto se puede leer cuando el iterador está construido o cuando la cancelación de referencia del primero que se hace. De lo contrario, desreferencia sólo devuelve una copia del objeto más leído recientemente .
Original:
std::istream_iterator is a single-pass input iterator that reads successive objects of type T from the std::basic_istream object for which it was constructed, by calling the appropriate operator>>. The actual read operation is performed when the iterator is incremented, not when it is dereferenced. The first object may be read when the iterator is constructed or when the first dereferencing is done. Otherwise, dereferencing only returns a copy of the most recently read object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
El valor predeterminado construido std::istream_iterator se conoce como el de fin de flujo iterador. Cuando un std::istream_iterator válido alcanza el final de la secuencia subyacente, se hace igual a la iterador de final de secuencia. Desreferenciación o incrementarlo aún más invoca un comportamiento indefinido .
Original:
The default-constructed std::istream_iterator is known as the end-of-stream iterator. When a valid std::istream_iterator reaches the end of the underlying stream, it becomes equal to the end-of-stream iterator. Dereferencing or incrementing it further invokes undefined behavior.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Una implementación típica de std::istream_iterator tiene dos miembros de datos: un puntero al objeto std::basic_istream asociado y el último valor leído de tipo T .
Original:
A typical implementation of std::istream_iterator holds two data members: a pointer to the associated std::basic_istream object and the most recently read value of type T.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Al leer caracteres, std::istreambuf_iterator es más eficiente, ya que evita la sobrecarga de la construcción y destruyendo el objeto centinela una vez por personaje .
Original:
When reading characters, std::istreambuf_iterator is more efficient, since it avoids the overhead of constructing and destructing the sentry object once per character.
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
char_type CharT
traits_type Traits
istream_type std::basic_istream<CharT, Traits>

[editar] Las funciones miembro

construye una nueva istream_iterator
Original:
constructs a new istream_iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función)
(destructor)
(implícitamente declarado)
destructs an istream_iterator, including the cached value
(miembro público función)
obtiene una copia de la corriente element
accesses un miembro del elemento actual
Original:
obtains a copy of the current element
accesses a member of the current element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función)
avanza el istream_iterator
Original:
advances the istream_iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función)

[editar] Terceros funciones

compara dos istream_iterators
Original:
compares two istream_iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla)

Inherited from std::iterator

Member types

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
value_type T
difference_type Distance
pointer const T*
reference const T&
iterator_category std::input_iterator_tag

[editar] Ejemplo

#include <iostream>
#include <sstream>
#include <iterator>
#include <numeric>
 
int main()
{
    std::istringstream str("0.1 0.2 0.3 0.4");
    std::partial_sum(std::istream_iterator<double>(str),
                     std::istream_iterator<double>(),
                     std::ostream_iterator<double>(std::cout, " "));
}

Output:

0.1 0.3 0.6 1

[editar] Ver también

salida iterador que escribe en std::basic_ostream
Original:
output iterator that writes to std::basic_ostream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(clase de plantilla) [edit]
iterador de entrada que se lee de std::basic_streambuf
Original:
input iterator that reads from std::basic_streambuf
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(clase de plantilla) [edit]