std::basic_ostream::sentry
来自cppreference.com
< cpp | io | basic ostream
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <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输出流,并执行其他的任务,如果实现定义的必要。实现定义的清理,以及冲洗的输出流,如果有必要,在析构函数中执行,因此,它是一定会发生在抛出异常时,在输出.原文:
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.[编辑] 成员函数
构建哨兵object. All的准备工作都在这里完成 原文: constructs the sentry object. All the preparation tasks are done here (公共成员函数) | |
定型后的流对象格式化的输出或异常后,如果必要的话 原文: finalizes the stream object after formatted output or after exception, if necessary (公共成员函数) | |
operator= |
赋值运算符将被删除 (公共成员函数) |
如果编写的流对象的检查是成功的 原文: checks if the preparation of the stream object was successful (公共成员函数) |
[编辑] 示例
本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
插入格式化的数据 (公共成员函数) |