std::fpos<State>::state
来自 cppreference.cn
State state() const; |
(1) | |
void state( State st ); |
(2) | |
管理文件位置状态。
1) 返回文件位置状态的值。
2) 将文件位置状态替换为 st 的值。
对于标准库中使用的 std::fpos 特化,State
始终是 std::mbstate_t。
目录 |
[编辑] 参数
st | - | 状态的新值 |
[编辑] 返回值
1)
fpos
状态的当前值。2) (无)
[编辑] 示例
运行此代码
#include <cwchar> #include <iostream> #include <sstream> int main() { std::istringstream s("test"); std::mbstate_t st = s.tellg().state(); if (std::mbsinit(&st)) std::cout << "The stream is in the initial shift state\n"; }
输出
The stream is in the initial shift state
[编辑] 缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 发布时的行为 | 正确的行为 |
---|---|---|---|
LWG 441 | C++98 | 重载 (1) 未声明为 const(它在概要中是 const) | 添加了 const |
[编辑] 另请参阅
迭代多字节字符串所需的转换状态信息 (类) |