Пространства имён
Варианты
Действия

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

 
 
Библиотеки ввода / вывода
I / O манипуляторов
C-стиль I / O
Буферы
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(устарело)
Потоки
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Абстракций
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
Файл 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
Струнный 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
Массив 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(устарело)
ostrstream(устарело)
strstream(устарело)
Типы
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
Интерфейс Ошибка категории
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
Глобальные объекты
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.
Член функций
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)
Форматированный ввод
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<<
Неформатированная вход
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
Позиционирование
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
Разное
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)
Член классов
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
Не являющиеся членами функций
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)
 
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) (начиная с C++11)
Вставляет символ или строку символов.
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)
отформатированные выходные функции: они начинают исполнения построения объекта типа sentry, который очищает tie()'d выходные буферы при необходимости и проверяет поток ошибок. После завершения строительных работ, если часовой объект возвращается false, эти функции возвращают не пытаясь никаких выходных данных. Если ошибка появляется во время выходных, эти функции вызывают setstate(ios_base::failbit). Если исключение во время выходных, то IOS :: badbit установлен (за исключением подавляется, если exceptions()&badbit) != 0, в этом случае он выдается повторно)
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)
Вставляет символ ch. Если тип характера не CharT, он сначала преобразуется с os.widen(ch). Заполнение определяется как если бы Этап 3 num_put::put(). После вставки, width(0) называется.
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)
Вставки последовательных символов из массива символов, первый элемент, на который указывает 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.
  • для первой и третьей перегрузки (где CharT соответствует типу ch), точно traits::length(s) символы вставляются.
    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.
  • для второго перегрузки, точно std::char_traits<char>::length(s) символы вставляются.
    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.
  • За последние два перегрузок, точно traits::length(reinterpret_cast<const char*>(s)) вставляются.
    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.
Заполнение определяется как если бы Этап 3 num_put::put(). Все персонажи расширен использованием os.widen() перед вставкой. После вставки, width(0) называется.
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)
Вызывает соответствующие оператора вставки, учитывая RValue ссылкой на объект выходного потока (эквивалент 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.

Содержание

[править] Параметры

os -
Выходной поток для вставки данных
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 -
ссылка на символ для вставки
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 -
Указатель на строку символов для вставки
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.

[править] Возвращаемое значение

st

[править] Пример

#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';
}

Вывод:

Hello, world
1.2

[править] См. также

вставками отформатированные данные
Original:
inserts formatted data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(public функция-член) [edit]