std::basic_ios<CharT,Traits>:: narrow
| I/O manipulators | ||||
| Print functions (C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(C++20)
|
||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
| Synchronized Output | ||||
|
(C++20)
|
||||
| Types | ||||
| Error category interface | ||||
|
(C++11)
|
||||
|
(C++11)
|
| Member functions | ||||
| State functions | ||||
| Formatting | ||||
| Miscellaneous | ||||
|
basic_ios::narrow
|
||||
| Protected member functions | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
|
char
narrow
(
char_type c,
char
dfault
)
const
;
|
||
将当前区域设置特定的字符
c
转换为其标准等效形式。如有需要,结果会从
char_type
转换为
char
。如果无法执行转换,函数将返回
dfault
。
等效地调用 std:: use_facet < std:: ctype < char_type > > ( getloc ( ) ) . narrow ( c, dfault ) ; 。
参数
| c | - | 要转换的字符 |
| dfault | - | 转换失败时返回的字符 |
返回值
字符被转换为其标准等价形式后再转为 char 类型。若转换失败则返回 dfault 值。
参见
|
扩展字符
(公开成员函数) |
|
调用
do_narrow
(
std::ctype<CharT>
的公开成员函数)
|
|
|
若可能则将宽字符窄化为单字节窄字符
(函数) |