首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::use_facet

Defined in header <locale>

?

?

template< class Facet > const Facet& use_facet( const std::locale& loc );

?

?

获取对loc...

参数

loc

-

the locale object to query

返回值

返回对facet的引用。此函数返回的引用在任何情况下都是有效的。std::locale对象存在实现Facet...

例外

std::bad_cast如果std::has_facet<Facet>(loc)==false...

显示用户%27首选区域设置使用的3字母货币名称.

二次

代码语言:javascript
复制
#include <iostream>
#include <locale>
 
int main()
{
    std::locale loc = std::locale(""); // user's preferred locale
    std::cout << "Your currency string is "
              << std::use_facet<std::moneypunct<char, true>>(loc).curr_symbol() << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
Your currency string is USD

二次

另见

locale

set of polymorphic facets that encapsulate cultural differences (class)

has_facet

checks if a locale implements a specific facet (function template)

代码语言:txt
复制
 ? cppreference.com

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com