Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何从std::locale对象获取方面?_C++_Locale - Fatal编程技术网

C++ 如何从std::locale对象获取方面?

C++ 如何从std::locale对象获取方面?,c++,locale,C++,Locale,我想获取本地语言环境的numpunct方面。我可以通过构造一个空字符串std::locale native\u loc(“”)的对象来生成本地语言环境对象,但是一旦我有了它,我如何从中获得numpunt?我找到的文档并没有真正显示两者之间的联系。使用使用方面(locale): std::numpunct const&n=std::use_facet(std::locale(“”); 工作正常,谢谢。在查看文档时,我没有注意到这一点。一旦临时对象std::locale(“”)被销毁,返回的引用将无

我想获取本地语言环境的numpunct方面。我可以通过构造一个空字符串
std::locale native\u loc(“”
)的对象来生成本地语言环境对象,但是一旦我有了它,我如何从中获得
numpunt
?我找到的文档并没有真正显示两者之间的联系。

使用
使用方面(locale)

std::numpunct const&n=std::use_facet(std::locale(“”);

工作正常,谢谢。在查看
文档时,我没有注意到这一点。一旦临时对象
std::locale(“”
)被销毁,返回的引用将无效。
std::numpunct<char> const&n = std::use_facet< std::numpunct<char> >(std::locale(""));