std::basic_ostream::sentry
来自cppreference.com
< cpp | io | basic ostream
|
|
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. |
| Defined in header <ostream>
|
||
| template< class CharT, class Traits = std::char_traits<CharT> > class std::basic_istream<charT,traits>::sentry |
||
构造对象的类
basic_ostream::sentry在本地范围内的每一个成员函数的std::basic_ostream开始执行输出(格式化和未格式化)。它的构造准备输出流:如果流已处于故障状态,检查,刷新了tie()'D输出流,并执行其他的任务,如果实现定义的必要。实现定义的清理,以及冲洗的输出流,如果有必要,在析构函数中执行,因此,它是一定会发生在抛出异常时,在输出.Original:
An object of class
basic_ostream::sentry is constructed in local scope at the beginning of each member function of std::basic_ostream that performs output (both formatted and unformatted). Its constructor prepares the output stream: checks if the stream is already in a failed state, flushes the tie()'d output streams, and performs other implementation-defined tasks if necessary. Implementation-defined cleanup, as well as flushing of the output stream if necessary, is performed in the destructor, so that it is guaranteed to happen if exceptions are thrown during output.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.
[编辑] 成员函数
| 构建哨兵object. All的准备工作都在这里完成 Original: constructs the sentry object. All the preparation tasks are done here The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| 定型后的流对象格式化的输出或异常后,如果必要的话 Original: finalizes the stream object after formatted output or after exception, if necessary The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| operator= |
赋值运算符将被删除 Original: the assignment operator is deleted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) |
| 如果编写的流对象的检查是成功的 Original: checks if the preparation of the stream object was successful The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
[编辑] 为例
| 本节是不完整的 原因: no example |
[编辑] 另请参阅
| 插入格式化的数据 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. (公共成员函数) | |