std::locale::id

来自cppreference.com

 
 
本地化庫
語言環境方面
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
字元分類
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
轉換
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
wstring_convert(C++11)
wbuffer_convert(C++11)
小面類的基類
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
小面類
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
特定於語言環境的方面
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
代碼轉換方面
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8(C++11)
codecvt_utf16(C++11)
codecvt_utf8_utf16(C++11)
codecvt_mode(C++11)
C語言環境
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::locale
會員類型
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale::id
locale::facet
成員函數
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale::locale
locale::~locale
locale::operator=
locale::combine
locale::name
locale::operator==
locale::operator!=
locale::operator()
靜態成員函數
Original:
Static member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale::global
locale::classic
 
Defined in header <locale>
class locale::id;
std::locale::id提供的語言環境方面實現特定的標識。 std::locale::facet來自每個類必須有一個公共的靜態成員的類型std::locale::id和它實現的方面,每個std::locale對象保持一份索引他們的ids的.
Original:
The class std::locale::id provides implementation-specific identification of a locale facet. Each class derived from std::locale::facet must have a public static member of type std::locale::id and each std::locale object maintains a list of facets it implements, indexed by their ids.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 成員函數

構建一個新的ID
Original:
constructs a new id
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成員函數)
operator=
拷貝賦值運算符將被刪除
Original:
copy assignment operator is deleted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共成員函數)

[编辑] 為例

下面的例子演示了如何構建一個最小的自定義方面.
Original:
The following example shows how to construct a minimal custom facet.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <locale>
#include <iostream>
#include <locale>
 
struct myfacet : std::locale::facet
{
    myfacet(std::size_t refs=0) : facet(refs) {}
    static std::locale::id id;
};
 
std::locale::id myfacet::id;
 
int main()
{
    std::locale myloc(std::locale(), new myfacet);
    std::cout << "has_facet<myloc, myfacet> returns " << std::boolalpha
              << std::has_facet<myfacet>(myloc) << '\n';
}

Output:

has_facet<myloc, myfacet> returns true

[编辑] 另請參閱

來自這種類型的基類的所有方面類別:任何類別的各方面
Original:
the base class for all facet categories: each facet of any category is derived from this type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(類) [edit]