在VS2015他們作出如此的名稱,如果語言環境總是等於傳遞給構造函數(如果它是有效的)的說法:我認爲你必須使用setlocale()代替
// c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocinfo line 360
void _Construct(const string &_Str,
category _Cat)
{ // construct a locale with named facets
bool _Bad = false;
_Init();
if (_Cat != none)
{ // worth adding, do it
_TRY_BEGIN
_BEGIN_LOCINFO(_Lobj(_Cat, _Str.c_str()))
if (_Badname(_Lobj))
_Bad = true;
else
{ // name okay, build the locale
_Locimp::_Makeloc(_Lobj, _Cat, _Ptr, 0);
// The two lines below were added in VS2015
_Ptr->_Catmask = _Cat;
_Ptr->_Name = _Str.c_str(); // <--- Here they set the name forcefully
}
:
std::cout << setlocale(LC_ALL, "") << endl;
有它在std::locale
你可以做
std::locale loc(setlocale(LC_ALL, ""));
這適用於VS2013和VS2015。
是的,工作。但是,如何在std :: locale變量中捕獲它? – Flethuseo
@Flethuseo查看更新 –