std::ostreambuf_iterator (3) - Linux Manuals
std::ostreambuf_iterator: std::ostreambuf_iterator
NAME
std::ostreambuf_iterator - std::ostreambuf_iterator
Synopsis
Defined in header <iterator>
template< class CharT, class Traits = std::char_traits<CharT> >
class ostreambuf_iterator : public std::iterator<std::output_iterator_tag, (until C++17)
void, void, void, void>
template< class CharT, class Traits = std::char_traits<CharT> > (since C++17)
class ostreambuf_iterator;
std::ostreambuf_iterator is a single-pass LegacyOutputIterator that writes successive characters into the std::basic_streambuf object for which it was constructed. The actual write operation is performed when the iterator (whether dereferenced or not) is assigned to. Incrementing the std::ostreambuf_iterator is a no-op.
In a typical implementation, the only data members of std::ostreambuf_iterator are a pointer to the associated std::basic_streambuf and a boolean flag indicating if the the end of file condition has been reached.
Member types
Member type Definition
char_type CharT
traits_type Traits
streambuf_type std::basic_streambuf<CharT, Traits>
ostream_type std::basic_ostream<CharT, Traits>
Member functions
constructor (public member function)
destructor destructs an ostreambuf_iterator
(implicitly declared)
operator= (public member function)
operator* (public member function)
operator++ (public member function)
operator++(int)
failed (public member function)
Member types
Member type Definition
value_type void
difference_type void
pointer void
reference void
iterator_category std::output_iterator_tag
These member types are required to be obtained by inheriting from std::iterator<std::output_iterator_tag, void, void, void, void>. (until C++17)
Example
// Run this code
Output:
See also
istreambuf_iterator (class template)
ostream_iterator (class template)