std::basic_ostream<CharT,Traits>::basic_ostream
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
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) | (desde C++11) |
1)
Construye el objeto
basic_ostream, asignar valores iniciales a la clase base llamando 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)
El constructor de copia está protegida, y se elimina. Flujos de salida no son copiables .
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)
El constructor movimiento
basic_ios<CharT, Traits>::move(rhs) utiliza para mover todos los miembros basic_ios, a excepción de la rdbuf(), de rhs en *this. Este constructor movimiento está protegido: es llamado por los constructores de muebles se mueven las clases de flujo de salida std::basic_ofstream y std::basic_ostringstream, que sabe cómo mover correctamente el streambuffer asociado .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.
Parámetros
| sb | - | streambuffer utilizar como secuencia de salida
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 para inicializar desde
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. |
Ejemplo
Ejecuta este código
#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';
}
Salida:
7.1