Udostępnij za pośrednictwem


ostreambuf_iterator::ostreambuf_iterator

Konstrukcje ostreambuf_iterator jest inicjowana, aby pisać znaki do 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 Konstruktor inicjuje wskaźnik strumienia bufor wyjściowy z _Strbuf.

Drugi Konstruktor inicjuje wskaźnik strumienia bufor wyjściowy z _Ostr.rdbuf.Przechowywane wskaźnika nie może być pusty wskaźnik.

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>

Przestrzeń nazw: std

Zobacz też

Informacje

ostreambuf_iterator — Klasa

Standardowa biblioteka szablonów