istreambuf_iterator::istreambuf_iterator
Costruisce un istreambuf_iterator inizializzato per leggere i caratteri dal flusso di input.
istreambuf_iterator(
streambuf_type* _Strbuf = 0
) throw( );
istreambuf_iterator(
istream_type& _Istr
) throw( );
Parametri
_Strbuf
La soluzione tampone del flusso di input a cui istreambuf_iterator si sta connettendo._Istr
Il flusso di input a cui istreambuf_iterator si sta connettendo.
Note
Il primo costruttore inizializza il puntatore di input del buffer del flusso con _Strbuf.Il secondo costruttore inizializza il puntatore di input del buffer del flusso con _Istr.rdbufquindi eventualmente tenta di creare e archiviare un oggetto di tipo char.
Esempio
// istreambuf_iterator_istreambuf_iterator.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <algorithm>
#include <iostream>
int main( )
{
using namespace std;
// Following declarations will not compile:
istreambuf_iterator<char>::istream_type &istrm = cin;
istreambuf_iterator<char>::streambuf_type *strmbf = cin.rdbuf( );
cout << "(Try the example: 'Oh what a world!'\n"
<< " then an Enter key to insert into the output,\n"
<< " & use a ctrl-Z Enter key combination to exit): ";
istreambuf_iterator<char> charReadIn ( cin );
ostreambuf_iterator<char> charOut ( cout );
// Used in conjunction with replace_copy algorithm
// to insert into output stream and replace spaces
// with hyphen-separators
replace_copy ( charReadIn , istreambuf_iterator<char>( ),
charOut , ' ' , '-' );
}
Oh esempio world!
Oh esempio world! (Vedere l'esempio: “Oh esempio world!" quindi una chiave leave per inserire nell'output, & per utilizzare un CTRL alla z fornisce la combinazione di tasti all'uscita): Oh esempio world! Oh-che cosa-un- world! ^Z
Requisiti
intestazione: <iterator>
Spazio dei nomi: deviazione standard