◐ Shell
clean mode source ↗

std::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.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

Elemento definito nell'header

<iterator>

template< class T, class CharT = char, class Traits = std::char_traits<charT>> class ostream_iterator : public std::iterator<std::output_iterator_tag, void, void, void, void>

std::ostream_iterator è un passaggio singolo iteratore di output che scrive gli oggetti successivi di tipo T nell'oggetto std::basic_ostream per il quale è stato costruito, utilizzando operator<<. Opzionale delimitatore di stringa viene scritto nel flusso di output dopo ogni operazione di scrittura. L'operazione di scrittura viene eseguita quando l'iteratore (se referenziato o meno) è assegnato. Incremento del std::ostream_iterator è un no-op.

Original:

std::ostream_iterator is a single-pass output iterator that writes successive objects of type T into the std::basic_ostream object for which it was constructed, using operator<<. Optional delimiter string is written to the output stream after every write operation. The write operation is performed when the iterator (whether dereferenced or not) is assigned to. Incrementing the std::ostream_iterator is a no-op.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

In una tipica implementazione, i membri dei soli dati di std::ostream_iterator sono un puntatore al std::basic_ostream associato e un puntatore al primo carattere della stringa delimitatore.

Original:

In a typical implementation, the only data members of std::ostream_iterator are a pointer to the associated std::basic_ostream and a pointer to the first character in the delimiter string.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Durante la scrittura di caratteri, std::ostreambuf_iterator è più efficiente, dato che evita il sovraccarico di costruire e distruggendo l'oggetto sentinella una volta per carattere.

Original:

When writing characters, std::ostreambuf_iterator is more efficient, since it avoids the overhead of constructing and destructing the sentry object once per character.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Membri tipi

Membro tipo

Original:

Member type

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Definition
char_type CharT
traits_type Traits
ostream_type std::basic_ostream<CharT, Traits>

Membri funzioni

costruisce un nuovo ostream_iterator

Original:

constructs a new ostream_iterator

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(metodo pubblico)

distrugge un ostream_iterator

Original:

destructs an ostream_iterator

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(metodo pubblico)

scrive un oggetto alla sequenza uscita associata

Original:

writes a object to the associated output sequence

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(metodo pubblico)
no-op
(metodo pubblico)
no-op
(metodo pubblico)

Inherited from std::iterator

Member types

Membro tipo

Original:

Member type

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Definition
value_type void
difference_type void
pointer void
reference void
iterator_category std::output_iterator_tag

Esempio

#include <iostream>
#include <sstream>
#include <iterator>
#include <algorithm>
int main()
{
    std::istringstream str("0.1 0.2 0.3 0.4");
    std::partial_sum( std::istream_iterator<double>(str),
                      std::istream_iterator<double>(),
                      std::ostream_iterator<double>(std::cout, " "));
}

Output:

Vedi anche

uscita iteratore che scrive std::basic_streambuf

Original:

output iterator that writes to std::basic_streambuf

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(classe template) [modifica]

iteratore di input che legge da std::basic_istream

Original:

input iterator that reads from std::basic_istream

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(classe template) [modifica]