std::basic_ostream::basic_ostream
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> explicit basic_ostream( std::basic_streambuf<CharT, Traits>* sb ); |
(1) | |
protected: basic_ostream( const basic_ostream& rhs ) = delete; |
(2) | |
protected: basic_ostream( basic_ostream&& rhs ); |
(3) | (dal C++11) |
1)
Costruisce l'oggetto
basic_ostream, l'assegnazione di valori iniziali per la classe base chiamando basic_ios::init(sb).Original:
Constructs the
basic_ostream object, assigning initial values to the base class by calling basic_ios::init(sb).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.
2)
Il costruttore di copia è protetto, e viene eliminato. Flussi di uscita non sono copiabili.
Original:
The copy constructor is protected, and is deleted. Output streams are not copyable.
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.
3)
Il costruttore utilizza
basic_ios<CharT, Traits>::move(rhs) mossa per spostare tutti i membri basic_ios, tranne per il rdbuf(), da rhs in *this. Questo costruttore mossa è protetta: viene chiamato dai costruttori movimento delle classi mobili flusso di output std::basic_ofstream e std::basic_ostringstream, che sa come muoversi correttamente il streambuffer associato.Original:
The move constructor uses
basic_ios<CharT, Traits>::move(rhs) to move all basic_ios members, except for the rdbuf(), from rhs into *this. This move constructor is protected: it is called by the move constructors of movable output stream classes std::basic_ofstream and std::basic_ostringstream, which know how to correctly move the associated streambuffer.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.
Parametri
| sb | - | streambuffer utilizzare come sequenza di emissione
Original: streambuffer to use as output sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| rhs | - | basic_ostream per inizializzare da
Original: basic_ostream to initialize from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Esempio
#include <sstream>
#include <utility>
#include <iostream>
int main()
{
// std::ostream myout(std::cout); // ERROR: copy ctor is deleted
std::ostream myout(std::cout.rdbuf()); // OK: shares buffer with cout
// std::ostream s2(std::move(std::ostringstream() << 7.1)); // ERROR: move constructor
// is protected
std::ostringstream s2(std::move(std::ostringstream() << 7.1)); // OK: move ctor called
// through the derived class
myout << s2.str() << '\n';
}
Output:
7.1