Name
ostreambuf_iterator class template — Output iterator to write characters to a streambuf
Synopsis
template<typename charT, typename traits=char_traits<charT> > class ostreambuf_iterator : public iterator<output_iterator_tag,void,void,void,void> { public: typedef charT char_type; typedef traits traits_type; typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_ostream<charT,traits> ostream_type; ostreambuf_iterator(ostream_type& s) throw( ); ostreambuf_iterator(streambuf_type* s) throw( ); ostreambuf_iterator& operator=(charT c); ostreambuf_iterator& operator*( ); ostreambuf_iterator& operator++( ); ostreambuf_iterator& operator++(int); bool failed( ) const throw( ); };
The ostreambuf_iterator
class template wraps a basic_streambuf
object as an output
iterator to write characters to the stream buffer. Example 13-21 (under istreambuf_iterator
) shows how to use
streambuf
iterators to copy
files.
In the following descriptions of the member functions of
ostreambuf_iterator
, the data
member sbuf
is a pointer to the
iterator’s stream buffer. The sbuf
member
serves only to keep the function descriptions clear and simple; the
class is not required to have such a member, or a member with that
name.
-
ostreambuf_iterator
(ostream_type& s) throw( )
ostreambuf_iterator
(streambuf_type* sb) throw( )
Saves the stream buffer
s.rdbuf( )
orsb
insbuf
.ostreambuf_iterator&
operator=
(charT c)
Calls
sbuf
->sputc(c)
(only iffailed( )
returnsfalse
) and returns*this
.ostreambuf_iterator& ...
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.