IRIX 6.5 » Books » Developer »
Standard Template Library Programmer's Guide
(document number: 007-3426-004 / published: 1999-05-21)
table of contents | additional info | download
find in page
| Category: iterators | Component type: type |
vector<int> V; // ... copy(V.begin(), V.end(), ostream_iterator<int>(cout, "\n"));
| Parameter | Description | Default |
|---|---|---|
| T | The type of object that will be written to the ostream. The set of value types of an ostream_iterator consists of a single type, T. |
| Member | Where defined | Description |
|---|---|---|
| ostream_iterator(ostream&) | ostream_iterator | See below. |
| ostream_iterator(ostream&, const char* s) | ostream_iterator | See below. |
| ostream_iterator(const ostream_iterator&) | Output Iterator | The copy constructor |
| ostream_iterator& operator=(const ostream_iterator&) | Output Iterator | The assignment operator |
| ostream_iterator& operator=(const T&) | Output Iterator | Used to implement the Output Iterator requirement *i = t. [1] |
| ostream_iterator& operator*() | Output Iterator | Used to implement the Output Iterator requirement *i = t. [1] |
| ostream_iterator& operator++() | Output Iterator | Preincrement |
| ostream_iterator& operator++(int) | Output Iterator | Postincrement |
| output_iterator_tag iterator_category(const ostream_iterator&) | iterator tags | Returns the iterator's category. |
| Function | Description |
|---|---|
| ostream_iterator(ostream& s) | Creates an ostream_iterator such that assignment of t through it is equivalent to s << t. |
| ostream_iterator(ostream& s, const char* delim) | Creates an ostream_iterator such that assignment of t through it is equivalent to s << t << delim. |
[1] Note how assignment through an ostream_iterator is implemented. In general, unary operator* must be defined so that it returns a proxy object, where the proxy object defines operator= to perform the output operation. In this case, for the sake of simplicity, the proxy object is the ostream_iterator itself. That is, *i simply returns i, and *i = t is equivalent to i = t. You should not, however, rely on this behavior. It is an implementation detail, and it is not guaranteed to remain the same in future versions.
Standard Template Library Programmer's Guide
(document number: 007-3426-004 / published: 1999-05-21)
table of contents | additional info | download
Copyright © 1993-2007 SGI, Inc. All rights reserved.