std::basic_ostream::~basic_ostream
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> virtual ~basic_ostream(); |
||
Détruit l'objet
basic_ostream. Ce destructeur n'effectue aucune opération sur le streambuffer sous-jacent (rdbuf()): les destructeurs des flux de sortie dérivés tels que std::basic_ofstream et std::basic_ostringstream sont responsables pour appeler les destructeurs des streambuffers .Original:
Destroys the
basic_ostream object. This destructor does not perform any operation on the underlying streambuffer (rdbuf()): the destructors of the derived output streams such as std::basic_ofstream and std::basic_ostringstream are responsible for calling the destructors of the streambuffers.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 <sstream>
#include <iostream>
void add_words(std::streambuf* p)
{
std::ostream buf(p); // buf shares the buffer with s
buf << " is the answer";
} // calls the destructor of buf. p remains unaffected
int main()
{
std::ostringstream s;
s << 42;
add_words(s.rdbuf());
s << ".";
std::cout << s.str() << '\n';
}
Résultat :
42 is the answer.