Namensräume
Varianten
Aktionen

std::istream_iterator

Aus cppreference.com
< cpp‎ | iterator

 
 
Iterator Bibliothek
Iterator Primitiven
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
Iterator Adaptern
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
Stream-Iteratoren
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
Iterator Operationen
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)
Reichen Zugang
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
Member-Funktionen
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-Member-Funktionen
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 ist ein Single-Pass-Input-Iterator, die aufeinanderfolgende Objekte vom Typ T liest aus dem std::basic_istream Objekt, für das es gebaut, durch Aufrufen der entsprechenden operator>> wurde. Die eigentliche Lesevorgang wird durchgeführt, wenn der Iterator inkrementiert wird, nicht, wenn es dereferenziert wird. Der erste Gegenstand kann gelesen werden, wenn der Iterator konstruiert oder wenn die erste Dereferenzierung abgenommen werden kann. Ansonsten Dereferenzierung gibt nur eine Kopie des zuletzt gelesenen Objekt .
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.
Die Standard-konstruiert std::istream_iterator als Ende des Datenstroms Iterator bekannt. Wenn eine gültige std::istream_iterator das Ende des darunter liegenden Strom erreicht, wird sie gleich der End-of-Stream Iterator. Dereferenzierung oder Inkrementieren es weiter aufruft undefinierten Verhalten .
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.
Eine typische Implementierung std::istream_iterator hält zwei Datenelemente: ein Zeiger auf das zugehörige std::basic_istream Objekt und dem zuletzt gelesenen Wert vom Typ 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.
Beim Lesen Zeichen ist std::istreambuf_iterator effizienter, da sie den Aufwand für den Bau und zerstören die Wache Objekt einmal pro Charakter verhindert .
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.

Inhaltsverzeichnis

[Bearbeiten] Mitglied Typen

Mitglied Typ
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>

[Bearbeiten] Member-Funktionen

baut eine neue 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.

(öffentliche Elementfunktion)
(destructor)
(implizit deklariert)
destructs an istream_iterator, including the cached value
(öffentliche Elementfunktion)
erhält eine Kopie des aktuellen element
accesses ein Mitglied des aktuellen Elements
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.

(öffentliche Elementfunktion)
Fortschritte der 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.

(öffentliche Elementfunktion)

[Bearbeiten] Non-Member-Funktionen

vergleicht zwei 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.

(Funktions-Template)

Inherited from std::iterator

Member types

Mitglied Typ
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

[Bearbeiten] Beispiel

#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

[Bearbeiten] Siehe auch

Ausgabeiterator, die std::basic_ostream schreibt
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.

(Klassen-Template) [edit]
Input-Iterator, die aus std::basic_streambuf liest
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.

(Klassen-Template) [edit]