Share via


istreambuf_iterator

istreambuf_iterator

template<class E, class T = char_traits<E> >
    class istreambuf_iterator
        : public iterator<input_iterator_tag, T, Dist> {
public:
    typedef E char_type;
    typedef T traits_type;
    typedef T::int_type int_type;
    typedef basic_streambuf<E, T> streambuf_type;

    typedef basic_istream<E, T> istream_type;
    istreambuf_iterator(streambuf_type *sb = 0) throw();
    istreambuf_iterator(istream_type& is) throw();
    const E& operator*() const;
    const E *operator->();
    istreambuf_iterator& operator++();
    istreambuf_iterator operator++(int);
    bool equal(const istreambuf_iterator& rhs);
    };

The template class describes an input iterator object. It extracts elements of class E from an input stream buffer, which it accesses via an object it stores, of type pointer to basic_streambuf<E, ``T``>. After constructing or incrementing an object of class istreambuf_iterator with a non-null stored pointer, the object effectively attempts to extract and store an object of type E from the associated itput stream. (The extraction may be delayed, however, until the object is actually dereferenced or copied.) If the extraction fails, the object effectively replaces the stored pointer with a null pointer (thus making an end-of-sequence indicator).