std::fpos<State>:: state
From cppreference.net
|
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++ 标准。
| DR | 适用范围 | 发布时的行为 | 正确行为 |
|---|---|---|---|
| LWG 441 | C++98 | 重载 (1) 未声明为 const (在 概要说明 中为 const ) | 添加 const |
参见
|
用于迭代多字节字符串所需的转换状态信息
(类) |