std::ostream_iterator::operator=
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> ostream_iterator& operator=( const T& value ) |
||
Inserts
value dans le flux associé, puis insère le séparateur, s'il a été spécifié au moment de la construction .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.
You can help to correct and verify the translation. Click here for instructions.
Si le pointeur est
out_stream élément privée associée à la std::basic_ostream et delim est le pointeur vers le premier caractère dans le séparateur, l'effet est équivalent à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 toThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
*out_stream << value; if(delim != 0) *out_stream << delim; return *this;
Paramètres
| value | - | l'objet à insérer
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. |
Retourne la valeur
*this
Notes
T peut être n'importe quelle classe avec un opérateur << définie par l'utilisateurOriginal:
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.
You can help to correct and verify the translation. Click here for instructions.
Exemple
#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;
}
Résultat :
1, 2, 3, 3.14