std::basic_ostream - cppreference.com
来自cppreference.com
template< class CharT, class Traits = std::char_traits<CharT> > class basic_ostream : virtual public std::basic_ios<CharT, Traits> |
||
类模板 basic_ostream 提供字符流上的高层输出操作。受支持操作包含有格式输出(例如整数)和无格式输出(例如原始字符和字符数组)。此功能以 basic_streambuf 类所提供的接口实现,通过 basic_ios 基类访问。典型的实现中,basic_ostream 没有非继承的数据成员。
继承图
提供了几个针对常用字符类型的 typedef:
| 类型 | 定义 |
std::ostream
|
std::basic_ostream<char>
|
std::wostream
|
std::basic_ostream<wchar_t>
|
全局对象
标准库提供六个全局 basic_ostream 对象:
成员类型
| 成员类型 | 定义 |
char_type
|
CharT[编辑]
|
traits_type
|
Traits;Traits::char_type 不是 CharT 时程序非良构。[编辑]
|
int_type
|
Traits::int_type[编辑]
|
pos_type
|
Traits::pos_type[编辑]
|
off_type
|
Traits::off_type[编辑]
|
成员函数
| 构造对象 (公开成员函数) [编辑] | |
[虚] |
析构对象 (虚公开成员函数) [编辑] |
(C++11) |
从另一 basic_ostream 移动赋值 (受保护成员函数) [编辑] |
有格式输出 | |
| 插入带格式数据 (公开成员函数) [编辑] | |
无格式输出 | |
| 插入字符 (公开成员函数) [编辑] | |
| 按区块插入字符 (公开成员函数) [编辑] | |
寻位 | |
| 返回输出位置指示器 (公开成员函数) [编辑] | |
| 设置输出位置指示器 (公开成员函数) [编辑] | |
杂项 | |
| 与底层存储设备同步 (公开成员函数) [编辑] | |
(C++11) |
交换流对象,除了关联缓冲区 (受保护成员函数) [编辑] |
成员类
非成员函数
继承自 std::basic_ios
成员类型
| 成员类型 | 定义 |
char_type
|
CharT
|
traits_type
|
Traits
|
int_type
|
Traits::int_type
|
pos_type
|
Traits::pos_type
|
off_type
|
Traits::off_type
|
成员函数
状态函数 | |
| 检查是否没有发生错误,即是否可执行输入/输出操作 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 检查是否到达了文件末尾 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 检查是否发生了可恢复的错误 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 检查是否已发生不可恢复的错误 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 检查是否有错误发生(fail() 的同义词) ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
检查是否没有发生错误(!std::basic_ios::fail 的同义词) ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 返回状态标志 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 设置状态标志 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 修改状态标志 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
格式化 | |
| 复制格式化信息 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 管理填充字符 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
杂项 | |
| 管理异常掩码 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 设置本地环境 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 管理相关的流缓冲区 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 管理绑定的流 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 窄化字符 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |
| 拓宽字符 ( std::basic_ios<CharT,Traits> 的公开成员函数) [编辑]
| |