24.6 Stream Iterators - Output Stream Iterators
- Another form of iterator adapter
- Converts iterator operations into I/O stream operations
- Assigning to ostream_iterator places value in output stream
- To print collection c:
copy(c.begin(), c.end(),
ostream_iterator(cout));
- Takes optional 2nd argument, the separator string:
copy(c.begin(), c.end(),
ostream_iterator(cout, "\n"));
prev
|top
|next