◐ Shell
clean mode source ↗

std::ostream_iterator::operator= - 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>

ostream_iterator& operator=( const T& value )

Inserisce value nel flusso associato, quindi inserisce il delimitatore, se è stato specificato in fase di costruzione.

Original:

Inserts value into the associated stream, then inserts the delimiter, if one was specified at construction time.

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

Se out_stream è il puntatore membro privato alle istituzioni std::basic_ostream e delim è il puntatore al primo carattere del delimitatore, l'effetto è equivalente a

Original:

If out_stream is the private member pointer to the associated std::basic_ostream and delim is the pointer to the first character in the delimiter, the effect is equivalent to

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

*out_stream << value; if(delim != 0) *out_stream << delim; return *this;

Parametri

value -

l'oggetto da inserire

Original:

the object to insert

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

Valore di ritorno

*this

Note

T può essere qualsiasi classe con un utente definito << operatore

Original:

T can be any class with a user-defined operator<<

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

Esempio

#include <iostream>
#include <iterator>

int main()
{
    std::ostream_iterator<int> i1(std::cout, ", ");
    *i1++ = 1; // usual form, used by standard algorithms
    *++i1 = 2;
    i1 = 3; // neither * nor ++ are necessary
    std::ostream_iterator<double> i2(std::cout);
    i2 = 3.14;
}

Output: