Next : Algorithms, Previous : Istream Iterator, Top : Table of Contents


Ostream iterator

ostream_iterator Output Iterator
ostream_iterator<T> writes (using operator<<) successive elements onto the output stream from which it was constructed. If it was constructed with char* as a constructor argument, this string, called a delimiter string, is written to the stream after every T is written. It is not possible to get a value out of the output iterator. Its only use is as an output iterator in situations like :
while (first != last) *result++ = *first++;
(See Output iterators.)

ostream_iterator (ostream& s) Constructor on ostream_iterator
ostream_iterator (ostream& s, char *delimiter) Constructor on ostream_iterator
= (const T& value) Operator on ostream_iterator
* Operator on ostream_iterator
++ Operator on ostream_iterator

ostream_iterator is defined as:

template 

class ostream_iterator : public output_iterator {
public:
    ostream_iterator(ostream& s);
    ostream_iterator(ostream& s, const char* delimiter);
    ostream_iterator(const ostream_iterator& x);
    ~ostream_iterator();
    ostream_iterator& operator=(const T& value);
    ostream_iterator& operator*();
    ostream_iterator& operator++();
    ostream_iterator& operator++(int);
};

 

Top