Espacios de nombres
Variantes
Acciones

std::basic_ostream::operator<<

De cppreference.com
< cpp‎ | io‎ | basic ostream

 
 
Entrada / salida de la biblioteca
I / O manipuladores
C-estilo I / O
Buffers
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(obsoleto)
Arroyos
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstracciones
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
File I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Cadena de I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Matriz I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(obsoleto)
ostrstream(obsoleto)
strstream(obsoleto)
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Error interfaz categoría
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_ostream
Los objetos globales
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::operator=(C++11)
Entrada con formato
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::operator<<
Entrada sin formato
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::put
basic_ostream::write
Posicionamiento
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::tellp
basic_ostream::seekp
Varios
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::flush
basic_ostream::swap(C++11)
Clases de miembros
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::sentry
Terceros funciones
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator<<(std::basic_ostream)
 
basic_ostream& operator<<( short value );
basic_ostream& operator<<( unsigned short value );
(1)
basic_ostream& operator<<( int value );
basic_ostream& operator<<( unsigned int value );
(2)
basic_ostream& operator<<( long value );
basic_ostream& operator<<( unsigned long value );
(3)
basic_ostream& operator<<( long long value );
basic_ostream& operator<<( unsigned long long value );
(4) (desde C++11)
basic_ostream& operator<<( float value );

basic_ostream& operator<<( double value );

basic_ostream& operator<<( long double value );
(5)
basic_ostream& operator<<( bool value );
(6)
basic_ostream& operator<<( const void* value );
(7)
basic_ostream& operator<<( std::basic_streambuf<CharT, Traits>* sb);
(8)
basic_ostream& operator<<( basic_ostream& st,

                           std::ios_base& (*func)(std::ios_base&) );
basic_ostream& operator<<( basic_ostream& st,
                           std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) );
basic_ostream& operator<<( basic_ostream& st,

                           std::basic_ostream& (*func)(std::basic_ostream&) );
(9)
inserta datos en la corriente .
Original:
Inserts data into the stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Las versiones (1-7) del operador se comportan como funciones de salida con formato, y el 8) versión se comporta como función de salida sin formato. Estas funciones se inicia la ejecución mediante la construcción de un objeto de tipo sentry, que vacía los buffers de salida tie()'d si es necesario y comprueba los errores de la corriente. Después de la construcción, si se devuelve el objeto centinela false, las funciones devuelven sin pretender ninguna salida. Si ocurre un error durante la salida, las funciones de formato de salida establecido setstate(ios_base::failbit). Si se produce una excepción durante la salida, entonces ios :: badbit se establece (se suprime la excepción a menos que (exceptions()&badbit) != 0, en cuyo caso se vuelve a iniciar)
Original:
The (1-7) versions of the operator behave as formatted output functions, and the 8) version behaves as unformatted output function. These functions begin execution by constructing an object of type sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the functions return without attempting any output. If an error occurs during output, formatted output functions set setstate(ios_base::failbit). If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless (exceptions()&badbit) != 0, in which case it is rethrown)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-2)
Si value es short o int, entonces se echa a unsigned short o unsigned int si ios_base::flags() & ios_base::basefield es ios_base::oct o ios_base::hex. Después de eso, arroja a long en cualquier caso, y las salidas como en 3). Si value es unsigned short o unsigned int, arroja a unsigned long y salidas como en 3)
Original:
If value is short or int, then casts it to unsigned short or unsigned int if ios_base::flags() & ios_base::basefield is ios_base::oct or ios_base::hex. After that, casts to long in any case and outputs as in 3). If value is unsigned short or unsigned int, casts to unsigned long and outputs as in 3)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-4)
Inserta un valor entero llamando num_put::put(). Si la condición de fin de archivo se ha encontrado durante la salida (put().failed() == true), establece ios::badbit .
Original:
Inserts an integer value by calling num_put::put(). If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Inserta un valor de punto flotante llamando num_put::put() Si la condición de fin de archivo se ha encontrado durante la producción (put().failed() == true), establece ios::badbit .
Original:
Inserts a floating point value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Inserta bool valor llamando num_put::put() Si la condición de fin de archivo se ha encontrado durante la salida (put().failed() == true), establece ios::badbit .
Original:
Inserts bool value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Inserta un valor de puntero genérico llamando num_put::put() Si la condición de fin de archivo se ha encontrado durante la producción (put().failed() == true), establece ios::badbit .
Original:
Inserts a generic pointer value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
Inserta todos los datos de sb. Después de construir el objeto centinela, comprueba si sb es un puntero nulo. Si lo es, se ejecuta setstate(badbit) y salidas. De lo contrario, extrae caracteres de la secuencia de entrada controlado por sb y los inserta en *this hasta que una de las condiciones siguientes se cumplen:
Original:
Inserts all data from sb. After constructing the sentry object, checks if sb is a null pointer. If it is, executes setstate(badbit) and exits. Otherwise, extracts characters from the input sequence controlled by sb and inserts them into *this until one of the following conditions are met:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • de fin de archivo se produce en la secuencia de entrada;
    Original:
    end-of-file occurs on the input sequence;
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • insertar en la secuencia de salida de falla (en cuyo caso el carácter a ser insertado no se extrae);
    Original:
    inserting in the output sequence fails (in which case the character to be inserted is not extracted);
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • se produce una excepción (en cuyo caso se detecta la excepción) .
    Original:
    an exception occurs (in which case the exception is caught).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Si no hay caracteres se insertan, ejecuta setstate(badbit). Si se produjo una excepción durante la extracción, establece failbit
Original:
If no characters were inserted, executes setstate(badbit). If an exception was thrown while extracting, sets failbit
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Llamadas func(*this);. Esta sobrecarga se utiliza para implementar la producción de E / S tales como manipuladores std::endl .
Original:
Calls func(*this);. This overload is used to implement output I/O manipulators such as std::endl.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Parámetros

value -
entero, punto flotante, el valor boolean, o puntero a insertar
Original:
integer, floating-point, boolean, or pointer value to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
func -
funcionar a llamar
Original:
function to call
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sb -
puntero a la streambuffer para leer los datos de
Original:
pointer to the streambuffer to read the data from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

*this

[editar] Notas

No hay sobrecarga para los punteros a punteros volátiles o función (que no sean los que tienen firmas aceptadas por la 9) de sobrecarga). Intentando dar salida a esos objetos invoca conversión implícita a bool, y, para cualquier valor de puntero no nulo, el valor se imprime 1 (a menos que se estableció boolalpha) .
Original:
There are no overload for pointers to volatile or function pointers (other than the ones with signatures accepted by the 9) overload). Attempting to output such objects invokes implicit conversion to bool, and, for any non-null pointer value, the value 1 is printed (unless boolalpha was set).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
    std::istringstream input(" \"Some text.\" ");
    volatile int n = 42;
    double f = 3.14;
    bool b = true;;
    std::cout << n   // int overload
              << ' ' // non-member overload
              << std::boolalpha << b // bool overload
              << " " // non-member overload
              << std::fixed << f // double overload
              << input.rdbuf() // streambuf overload
              << &n // bool overload
              << std::endl; // function overload
}

Output:

42 true 3.140000 "Some text." true

[editar] Ver también

inserciones de datos de caracteres
Original:
inserts character data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]
realiza secuencia de E / S de cadenas
Original:
performs stream I/O of strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla)
realiza flujo de entrada y salida de bitsets
Original:
performs stream input and output of bitsets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función)
serializa y deserializa un número complejo
Original:
serializes and deserializes a complex number
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla)
realiza flujo de entrada y de salida en el motor de número pseudo-aleatorio
Original:
performs stream input and output on pseudo-random number engine
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]
realiza flujo de entrada y salida en la distribución de números pseudo-aleatorios
Original:
performs stream input and output on pseudo-random number distribution
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]
inserta un carácter
Original:
inserts a character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función) [edit]
inserciones de bloques de caracteres
Original:
inserts blocks of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función) [edit]