reverse_iterator, istream_iterator, istreambuf_iterator class in C++

reverse_iterator: It is used to reverse the operations of a regular iterator. It is declared as:

template <class Iter> class reverse_iterator:

public iterator<iterator_traits<Iter>::iterator_category,





Iter can be either a random access iterator or a bidirectional iterator. Iter has the constructor:

reverse_iterator( );

explicit reverse_iterator(Iter itr);

If Iter is a random access iterator then it has operators: –>, +, ++, –, −−, *, <, >, <=, >=, –=, +=, ==, !=, and [ ]

If Iter is a bidirectional iterator then it has operators: –>, ++, −−, *, ==, !=

istream_iterator: It is used for a stream to perform input operations.

istream_iterator is declared as:

template <class D, class CharType, class Attr = char_traits<CharType>,

class Diff = ptrdiff_d> class istream_iterator:

public iterator<input_iterator_tag, D, Diff, const D *, const D &>

It has the constructors:

istream_iterator( );

istream_iterator(istream_type &stream);

istream_iterator(const istream_iterator<D, CharType, Attr, Diff> &ob);

Operators used by istream_iterator: –>, *, ++

istreambuf_iterator: It is used for a stream to perform character input operations.

istreambuf_iterator is declared as:

template <class CharType, class Attr = char_traits<CharType> >

class istreambuf_iterator:

public iterator<input_iterator_tag, CharType, typename Attr::off_type,

CharType *, CharType &>

istreambuf_iterator has the following constructors:

istreambuf_iterator( ) throw( );

istreambuf_iterator(istream_type &stream) throw( );

istreambuf_iterator(streambuf_type *streambuf) throw( );

Operators used by istreambuf_iterator: *, ++

Leave a Reply