operator<<<div class="t-tr-text">(性病:: 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>
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| template< class CharT, class Traits> basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os, |
(1) | |
| template< class CharT, class Traits > basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os, |
(2) | |
| template< class CharT, class Traits, class T > basic_ostream< charT, traits >& operator<<( basic_ostream<CharT,Traits>&& os, |
(3) | (C++11 起) |
You can help to correct and verify the translation. Click here for instructions.
sentry,刷新tie()'d的输出缓冲区,如果必要的检查流错误。项目建成后,如果哨兵对象返回false,这些函数返回没有尝试任何输出。如果发生错误,在输出过程中,这些函数调用setstate(ios_base::failbit)。如果抛出一个异常,然后在输出的ios :: badbit(exceptions()&badbit) != 0被抑制,除非,在这种情况下,它被重新抛出异常)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)You can help to correct and verify the translation. Click here for instructions.
ch。如果字符的类型是不CharT,它首先被转化os.widen(ch)。如果第3阶段num_put::put()填充确定。在插入之后,被称为width(0).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.You can help to correct and verify the translation. Click here for instructions.
s.s.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 (whereCharTmatches the type ofch), exactlytraits::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.
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.
目录 |
[编辑] 参数
| 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'; }
Output:
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. (公共成员函数) | |