Namensräume
Varianten
Aktionen

std::istreambuf_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::istreambuf_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.
istreambuf_iterator::istreambuf_iterator
istreambuf_iterator::operator*
istreambuf_iterator::operator->

(C++11)
istreambuf_iterator::operator++
istreambuf_iterator::operator++(int)
istreambuf_iterator::equal
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!=
 
definiert in Header <iterator>
template< class CharT, class Traits = std::char_traits<CharT> >

class istreambuf_iterator : public std::iterator< std::input_iterator_tag,
                                                  CharT,
                                                  typename Traits::off_type,
                                                  /* unspecified, usually CharT* */,

                                                  CharT >
std::istreambuf_iterator ist ein Single-Pass-Input-Iterator, die aufeinanderfolgende Zeichen aus dem std::basic_streambuf Objekt, für das es konstruiert wurde liest. Die eigentliche Lesevorgang wird durchgeführt, wenn der Iterator inkrementiert wird, nicht, wenn es dereferenziert wird. Das erste Zeichen lesen kann, wenn der Iterator konstruiert oder wenn die erste Dereferenzierung abgenommen werden kann. Ansonsten Dereferenzierung gibt nur eine Kopie des zuletzt gelesenen Charakter .
Original:
std::istreambuf_iterator is a single-pass input iterator that reads successive characters from the std::basic_streambuf object for which it was constructed. The actual read operation is performed when the iterator is incremented, not when it is dereferenced. The first character 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 character.
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::istreambuf_iterator als Ende des Datenstroms Iterator bekannt. Wenn eine gültige std::istreambuf_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::istreambuf_iterator is known as the end-of-stream iterator. When a valid std::istreambuf_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.
std::istreambuf_iterator hat einen trivialen Copy-Konstruktor, eine constexpr Standardkonstruktor und einen trivialen Destruktor .
Original:
std::istreambuf_iterator has a trivial copy constructor, a constexpr default constructor, and a trivial destructor.
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
int_type typename traits::int_type
streambuf_type std::basic_streambuf<CharT, Traits>
istream_type std::basic_istream<CharT, Traits>

[Bearbeiten] Member-Funktionen

baut eine neue istreambuf_iterator
Original:
constructs a new istreambuf_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 istreambuf_iterator
(öffentliche Elementfunktion)
erhält eine Kopie des aktuellen character
accesses ein Mitglied der aktuellen Charakter, wenn CharT Mitglieder hat
Original:
obtains a copy of the current character
accesses a member of the current character, if CharT has members
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 istreambuf_iterator
Original:
advances the istreambuf_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)
wenn beide Tests istreambuf_iterators End-of-Stream sind oder wenn beide gültig sind
Original:
tests if both istreambuf_iterators are end-of-stream or if both are valid
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 istreambuf_iterators
Original:
compares two istreambuf_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 CharT
difference_type Traits::off_type
pointer /* unspecified, usually CharT* */
reference CharT
iterator_category std::input_iterator_tag

[Bearbeiten] Beispiel

#include <vector>
#include <sstream>
#include <iostream>
#include <iterator>
int main()
{
    // typical use case: an input stream represented as a pair of iterators
    std::istringstream in("Hello, world");
    std::vector<char> v( (std::istreambuf_iterator<char>(in)),
                          std::istreambuf_iterator<char>() );
    std::cout << "v has " << v.size() << " bytes. ";
    v.push_back('\0');
    std::cout << "it holds \"" << &v[0] << "\"\n";
 
 
    // demonstration of the single-pass nature
    std::istringstream s("abc");
    std::istreambuf_iterator<char> i1(s), i2(s);
    std::cout << "i1 returns " << *i1 << '\n'
              << "i2 returns " << *i2 << '\n';
    ++i1;
    std::cout << "after incrementing i1, but not i2\n"
              << "i1 returns " << *i1 << '\n'
              << "i2 returns " << *i2 << '\n';
    ++i2; // this makes the apparent value of *i2 to jump from 'a' to 'c'
    std::cout << "after incrementing i2, but not i1\n"
              << "i1 returns " << *i1 << '\n'
              << "i2 returns " << *i2 << '\n';
 
}

Output:

v has 12 bytes. it holds "Hello, world"
i1 returns a
i2 returns a
after incrementing i1, but not i2
i1 returns b
i2 returns a
after incrementing i2, but not i1
i1 returns b
i2 returns c

[Bearbeiten] Siehe auch

Ausgabeiterator, die std::basic_streambuf schreibt
Original:
output iterator that writes to 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]
Input-Iterator, die aus std::basic_istream liest
Original:
input iterator that reads from std::basic_istream
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]