Udostępnij za pośrednictwem


ostreambuf_iterator::ostreambuf_iterator

Konstrukcje ostreambuf_iterator , jest inicjowany zapisu znaków strumienia wyjściowego.

ostreambuf_iterator(
   streambuf_type* _Strbuf
) throw( );
ostreambuf_iterator(
   ostream_type& _Ostr
) throw( );

Parametry

  • _Strbuf
    Dane wyjściowe obiektu streambuf używany do zainicjowania wskaźnika buforu strumienia wyjściowego.

  • _Ostr
    Obiekt strumienia wyjściowego używany do zainicjowania wskaźnika buforu strumienia wyjściowego.

Uwagi

Pierwszy konstruktora inicjuje wskaźnik strumienia bufor wyjściowy z _Strbuf.

Drugi konstruktor inicjuje wskaźnik strumienia bufor wyjściowy z _Ostr.rdbuf.Wskaźnik przechowywane nie może być null wskaźnika.

Przykład

// ostreambuf_iterator_ostreambuf_iterator.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;

   // ostreambuf_iterator for stream cout
   ostreambuf_iterator<char> charOut ( cout );
   
   *charOut = 'O';
   charOut ++;
   *charOut  = 'U';
   charOut ++;   
   *charOut = 'T';
   cout << " are characters output individually." << endl;

   ostreambuf_iterator<char> strOut ( cout );
   string str = "These characters are being written to the output stream.\n ";
   copy ( str.begin ( ), str. end ( ), strOut );
}
  
  

Wymagania

Nagłówek: <iterator>

Obszar nazw: std

Zobacz też

Informacje

ostreambuf_iterator Class

Standardowa biblioteka szablonu