std::istreambuf_iterator (3) - Linux Manuals
std::istreambuf_iterator: std::istreambuf_iterator
NAME
std::istreambuf_iterator - std::istreambuf_iterator
Synopsis
Defined in header <iterator>
template< class CharT, class Traits = std::char_traits<CharT> >
class istreambuf_iterator : public std::iterator< std::input_iterator_tag,
CharT, (until C++17)
typename Traits::off_type,
/* unspecified, usually CharT* */,
CharT >
template< class CharT, class Traits = std::char_traits<CharT> > (since C++17)
class istreambuf_iterator;
std::istreambuf_iterator is a single-pass input iterator that reads successive characters from the std::basic_streambuf object for which it was constructed.
The default-constructed std::istreambuf_iterator is known as the end-of-stream iterator. When a valid std::istreambuf_iterator reaches the end of the underlying stream, it becomes equal to the end-of-stream iterator. Dereferencing or incrementing it further invokes undefined behavior.
std::istreambuf_iterator has a trivial copy constructor, a constexpr default constructor, and a trivial destructor.
Member types
Member type Definition
char_type CharT
traits_type Traits
int_type typename traits::int_type
streambuf_type std::basic_streambuf<CharT, Traits>
istream_type std::basic_istream<CharT, Traits>
/* proxy */ A proxy object holds a char_type character and a streambuf_type* pointer.
Member functions
constructor (public member function)
destructor destructs an istreambuf_iterator
(implicitly declared)
operator* obtains a copy of the current character
operator-> accesses a member of the current character, if CharT has members
(since C++11)(until C++17)
operator++ (public member function)
operator++(int)
equal (public member function)
Non-member functions
operator== (function template)
operator!=
Member types
Member type Definition
value_type CharT
difference_type Traits::off_type
pointer /* unspecified, usually CharT* */
reference CharT
iterator_category std::input_iterator_tag
These member types are required to be obtained by inheriting from std::iterator<std::input_iterator_tag, CharT, Traits::off_type, /* unspecified, usually CharT* */, CharT>. (until C++17)
Example
// Run this code