[ostream.iterator.general]

# 24 Iterators library [[iterators]](./#iterators)

## 24.6 Stream iterators [[stream.iterators]](stream.iterators#ostream.iterator.general)

### 24.6.3 Class template ostream_iterator [[ostream.iterator]](ostream.iterator#general)

#### 24.6.3.1 General [ostream.iterator.general]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6725)

ostream_iterator writes (usingoperator<<)
successive elements onto the output stream from which it was constructed[.](#1.sentence-1)

If it was constructed withcharT* as a constructor argument, this string, called a[*delimiter string*](#def:delimiter_string),
is written to the stream after everyT is written[.](#1.sentence-2)

namespace std {template<class T, class charT = char, class traits = char_traits<charT>>class ostream_iterator {public:using iterator_category = output_iterator_tag; using value_type = void; using difference_type = ptrdiff_t; using pointer = void; using reference = void; using char_type = charT; using traits_type = traits; using ostream_type = basic_ostream<charT,traits>;

 ostream_iterator(ostream_type& s);
 ostream_iterator(ostream_type& s, const charT* delimiter);
 ostream_iterator(const ostream_iterator& x); ~ostream_iterator();
 ostream_iterator& operator=(const ostream_iterator&) = default;
 ostream_iterator& operator=(const T& value);

 ostream_iterator& operator*();
 ostream_iterator& operator++();
 ostream_iterator& operator++(int); private: basic_ostream<charT,traits>* out_stream; // *exposition only*const charT* delim; // *exposition only*};}
