在线文档教程
C++
本土化 | Localizations

std::locale::combine

地区::合并

Defined in header
template< class Facet > locale combine( const locale& other ) const;

构造一个区域设置对象,该对象是*this除了类型的面Facet,它是从other...

返回值

新的无名的地方。

例外

std::runtime_error如果other不实现Facet...

二次

#include <iostream> #include <locale> int main() { const double number = 1000.25; std::cout << "\"C\" locale: " << number << '\n'; std::locale loc = std::locale().combine<std::numpunct<char>>(std::locale("en_US.UTF8") std::cout.imbue(loc std::cout << "\"C\" locale with en_US numpunct: " << number << '\n'; }

二次

产出:

二次

"C" locale: 1000.25 "C" locale with en_US numpunct: 1,000.25

二次

另见

(constructor)constructs a new locale (public member function)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/locale/locale/Composal