Espaces de noms
Variantes
Affichages
Actions

std::istream_iterator

De cppreference.com
< cpp‎ | iterator

 
 
Bibliothèque Iterator
Primitives Iterator
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
Adaptateurs Iterator
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
Itérateurs de flux
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
Opérations Iterator
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)
Gamme d'accès
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
Les fonctions membres
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)
Tiers fonctions
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 est un itérateur d'entrée en un seul passage qui lit les objets successifs de T Type de l'objet pour lequel std::basic_istream il a été construit, en appelant le operator>> approprié. L'opération de lecture réelle est effectuée lorsque l'itérateur est incrémenté, pas quand il est déréférencé. Le premier objet peut être lu lorsque l'itérateur est construit ou lorsque le déréférencement premier pas est fait. Dans le cas contraire, le déréférencement ne renvoie une copie de l'objet le plus lu récemment .
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.
La valeur par défaut construit std::istream_iterator est connue comme la fin de flux itérateur. Quand un std::istream_iterator valide atteint la fin du flux sous-jacent, il devient égal à l'itérateur de fin de courant. Déréférencement ou l'incrémentant invoque par ailleurs un comportement indéfini .
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.
Une implémentation typique de std::istream_iterator est titulaire de deux membres de données: un pointeur sur l'objet std::basic_istream associé et la valeur la plus récemment lue de type 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.
Lors de la lecture des caractères, std::istreambuf_iterator est plus efficace, car elle permet d'éviter la surcharge de la construction et de détruire l'objet sentinelle fois par personnage .
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.

Sommaire

[modifier] Types de membres

Type du membre Définition
char_type CharT
traits_type Traits
istream_type std::basic_istream<CharT, Traits>

[modifier] Fonctions membres

construit un nouveau 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.

(fonction membre publique)
(destructor)
(implicitement déclaré)
destructs an istream_iterator, including the cached value
(fonction membre publique)
obtient une copie du courant element
accesses un élément de l'élément courant
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.

(fonction membre publique)
les progrès de la 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.

(fonction membre publique)

[modifier] Fonctions annexes

compare deux 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.

(fonction générique)

Inherited from std::iterator

Member types

Type du membre Définition
value_type T
difference_type Distance
pointer const T*
reference const T&
iterator_category std::input_iterator_tag

[modifier] Exemple

#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, " "));
}

Résultat :

0.1 0.3 0.6 1

[modifier] Voir aussi

itérateur de sortie qui écrit dans 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 générique) [edit]
itérateur d'entrée qui lit 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 générique) [edit]