std::ostream_iterator::ostream_iterator - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
|
|
(1) | |
|
|
(2) | |
1) Constructs the iterator with the private ostream_type* member initialized with &stream and the private delimiter pointer initialized with delim.
2) Constructs the iterator with the private ostream_type* member initialized with &stream and the private delimiter pointer initialized with null pointer value.
Parametri
| stream | - | the output stream to be accessed by this iterator |
| delim | - | the null-terminated character string to be inserted into the stream after each output |
Esempio
#include <iostream> #include <iterator> #include <algorithm> int main() { std::ostream_iterator<int> i1(std::cout, ", "); std::fill_n(i1, 5, -1); std::ostream_iterator<double> i2(std::cout); *i2++ = 3.14; }
Output: