Share via


ostream_iterator

ostream_iterator

template<class U, class E=char, class Tr=char_traits<E> >
    class ostream_iterator
        : public iterator<output_iterator_tag, void, void> {
public:
    typedef U value_type;
    typedef E char_type;
    typedef T traits_type;
    typedef basic_ostream<E, T> ostream_type;
    ostream_iterator(ostream_type& os);
    ostream_iterator(ostream_type& os, const E *delim);
    ostream_iterator<U, E, T>& operator=(const U& val);
    ostream_iterator<U, E, T>& operator*();
    ostream_iterator<U, E, T>& operator++();
    ostream_iterator<U, E, T> operator++(int);
    };

The template class describes an output iterator object. It inserts objects of class U into an output stream, which it accesses via an object it stores, of type pointer to basic_ostream<``E``, ``T``>. It also stores a pointer to a delimiter string, a null-terminated string of elements of type E, which is appended after each insertion. (Note that the string itself is not copied by the constructor.)