std::basic_ios<CharT,Traits>:: imbue
| 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::imbue
|
||||
| Protected member functions | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
|
std::
locale
imbue
(
const
std::
locale
&
loc
)
;
|
||
替换当前区域设置。实际上调用了 ios_base :: imbue ( loc ) ,若存在关联的流缓冲区( rdbuf ( ) ! = 0 ),则继续调用 rdbuf ( ) - > pubimbue ( loc ) 。
目录 |
参数
| loc | - | 新区域设置 |
返回值
先前区域设置,由 ios_base :: imbue ( loc ) 返回。
异常
可能抛出实现定义的异常。
示例
#include <iostream> #include <locale> #include <sstream> int main() { std::istringstream iss; iss.imbue(std::locale("en_US.UTF8")); std::cout << "Current locale: " << iss.getloc().name() << '\n'; iss.imbue(std::locale()); std::cout << "Global locale : " << iss.getloc().name() << '\n'; }
输出:
Current locale: en_US.UTF8 Global locale : C