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 estrarre e archiviare un oggetto di tipo CharType.
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 determinato world!
FakePre-d14736becb724b6eb1ec3acf8f73f624-de1f7e8fd09a40c192e7c4424c98a7b8
Requisiti
Intestazione: <iteratore>
Spazio dei nomi: std