(Std :: basic_ostream)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">(std::basic_ostream)</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> - cppreference.com" /> operator<<<div class="t-tr-text">(Std :: basic_ostream)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">(std::basic_ostream)</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> - cppreference.com
Espacios de nombres
Variantes
Acciones

operator<<<div class="t-tr-text">(Std :: basic_ostream)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">(std::basic_ostream)</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div>

De cppreference.com
< cpp‎ | io‎ | basic ostream
 
 
Biblioteca de E/S
Manipuladores de E/S
E/S estilo C
Búferes
(en desuso en C++98)
Flujos
Abstracciones
E/S de archivos
E/S de cadenas
E/S de arrays
(en desuso en C++98)
(en desuso en C++98)
(en desuso en C++98)
Salida sincronizada
Tipos
Interfaz de categoría de error
(C++11)
 
 
template< class CharT, class Traits>

basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os,
                                         CharT ch );
template< class CharT, class Traits>
basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os,
                                         char ch );
template< class Traits >
basic_ostream<char,Traits>& operator<<( basic_ostream<char,Traits>& os,
                                        char ch );
template< class Traits >
basic_ostream<char,Traits>& operator<<( basic_ostream<char,Traits>& os,
                                        signed char ch );
template< class Traits >
basic_ostream<char,Traits>& operator<<( basic_ostream<char,Traits>& os,

                                        unsigned char ch );
(1)
template< class CharT, class Traits >

basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os,
                                         const CharT* s );
template< class CharT, class Traits >
basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os,
                                         const char* s );
template< class Traits >
basic_ostream<char,Traits>& operator<<( basic_ostream<char,Traits>& os,  
                                        const char* s );
template< class Traits >
basic_ostream<char,Traits>& operator<<( basic_ostream<char,Traits>& os,
                                        const signed char* s );
template< class Traits >
basic_ostream<char,Traits>& operator<<( basic_ostream<char,traits>& os,

                                        const unsigned char* s );
(2)
template< class CharT, class Traits, class T >

basic_ostream< charT, traits >& operator<<( basic_ostream<CharT,Traits>&& os,

                                            const T& value );
(3) (desde C++11)
Inserta un carácter o una cadena de caracteres .
Original:
Inserts a character or a character string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-2)
se formatean las funciones de salida: 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, estas funciones devuelven sin pretender ninguna salida. Si ocurre un error durante la salida, estas funciones setstate(ios_base::failbit) llamar. 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:
are formatted output functions: they 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, these functions return without attempting any output. If an error occurs during output, these functions call 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)
Inserta un ch carácter. Si el tipo del carácter no es CharT, se convierte primero con os.widen(ch). El relleno se determina como si por Etapa 3 de num_put::put(). Después de la inserción, width(0) se llama .
Original:
Inserts a character ch. If the type of the character is not CharT, it is first converted with os.widen(ch). Padding is determined as if by Stage 3 of num_put::put(). After insertion, width(0) is called.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Inserta caracteres sucesivos de la matriz de caracteres cuyo primer elemento es apuntado por s .
Original:
Inserts successive characters from the character array whose first element is pointed to by s.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • para las sobrecargas primera y tercera (donde CharT coincide con el tipo de ch), exactamente traits::length(s) caracteres se insertan .
    Original:
    for the first and third overloads (where CharT matches the type of ch), exactly traits::length(s) characters are inserted.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • para la segunda sobrecarga, exactamente std::char_traits<char>::length(s) caracteres se insertan .
    Original:
    for the second overload, exactly std::char_traits<char>::length(s) characters are inserted.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • durante los últimos dos sobrecargas, exactamente traits::length(reinterpret_cast<const char*>(s)) se insertan .
    Original:
    for the last two overloads, exactly traits::length(reinterpret_cast<const char*>(s)) are inserted.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
El relleno se determina como si por Etapa 3 de num_put::put(). Todos los caracteres se ensancha utilizando os.widen() antes de la inserción. Después de la inserción, width(0) se llama .
Original:
Padding is determined as if by Stage 3 of num_put::put(). All characters are widened using os.widen() before insertion. After insertion, width(0) is called.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Llama al operador de inserción apropiado, dada una referencia a un objeto de valor-stream de salida (equivalente a os << value) .
Original:
Calls the appropriate insertion operator, given an rvalue reference to an output stream object (equivalent to os << value).
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

os -
salida de corriente para insertar datos
Original:
output stream to insert data to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ch -
referencia a un carácter a insertar
Original:
reference to a character to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
s -
puntero a una cadena de caracteres a insertar
Original:
pointer to a character string to insert
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

st

[editar] Ejemplo

#include <iostream>
#include <sstream>
int main()
{
    std::cout << "Hello, world" // the const char* overlaod
              << '\n';          // the char overload
    std::string s = (std::ostringstream() << 1.2).str(); // rvalue overload
    std::cout << s << '\n';
}

Salida:

Hello, world
1.2

[editar] Ver también

Inserta datos con formato.
(función miembro pública) [editar]