Namespace
Varianti

std::istream_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.
istream_iterator::istream_iterator
istream_iterator::operator*
istream_iterator::operator->
istream_iterator::operator++
istream_iterator::operator++(int)
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!=
 
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 è un passaggio singolo iteratore di input che legge gli oggetti successivi di tipo T dall'oggetto std::basic_istream per cui è stata costruita, chiamando il operator>> appropriato. L'operazione di lettura reale viene eseguita quando l'iteratore non viene incrementato, quando è dereferenziato. Il primo oggetto può essere letto quando l'iteratore è costruito o quando la dereferenziazione primo fatto. In caso contrario, dereferenziare solo restituisce una copia dell'oggetto più letto di recente.
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.
L'impostazione predefinita-costruito std::istream_iterator è conosciuta come la fine flusso di iteratore. Quando un std::istream_iterator valida raggiunge la fine del flusso sottostante, diventa uguale al fine flusso iteratore. Dereferenziazione o incrementarlo richiede ulteriori comportamento indefinito.
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 tipica implementazione di std::istream_iterator tiene due membri di dati: un puntatore all'oggetto std::basic_istream associato e il valore più letto di recente di 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.
Durante la lettura di caratteri, std::istreambuf_iterator è più efficiente, dato che evita il sovraccarico di costruire e distruggendo l'oggetto sentinella una volta per carattere.
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.

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
char_type CharT
traits_type Traits
istream_type std::basic_istream<CharT, Traits>

[modifica] Membri funzioni

costruisce un nuovo 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.

(membro pubblico funzione)
(destructor)
(dichiarato in modo implicito)
destructs an istream_iterator, including the cached value
(membro pubblico funzione)
ottiene una copia della corrente element
accesses membro dell'elemento corrente
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.

(membro pubblico funzione)
fa avanzare il 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.

(membro pubblico funzione)

[modifica] Non membri funzioni

confronta due 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.

(funzione di modello)

Inherited from std::iterator

Member types

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

[modifica] Esempio

#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

[modifica] Vedi anche

uscita iteratore che scrive 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.

(classe template) [edit]
iteratore di input che legge da 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.

(classe template) [edit]