名稱空間
變體
操作

std::collate_byname

來自 cppreference.com
< cpp‎ | locale
 
 
 
 
定義於標頭檔案 <locale>
template< class CharT >
class collate_byname : public std::collate<CharT>;

std::collate_byname 是一個 std::collate 方面(facet),它封裝了特定於語言環境的字串整理(比較)和雜湊。與 std::collate 一樣,它可以被注入到 std::regex 中,並透過 std::locale::operator() 直接應用於所有期望字串比較謂詞的標準演算法。

目錄

[編輯] 特化

標準庫保證提供以下特化

定義於標頭檔案 <locale>
std::collate_byname<char> 多位元組字串的語言環境特定整理
std::collate_byname<wchar_t> 寬字串的語言環境特定整理

[編輯] 成員函式

(建構函式)
構造新的 collate_byname 方面(facet)
(公有成員函式) [編輯]
(解構函式)
銷燬 collate_byname 方面(facet)
(受保護成員函式) [編輯]

std::collate_byname::collate_byname

explicit collate_byname( const char* name, std::size_t refs = 0 );
explicit collate_byname( const std::string& name, std::size_t refs = 0 );
(C++11 起)

為具有 name 的語言環境構造一個新的 std::collate_byname 方面。

refs 用於資源管理:如果 refs == 0,則當持有它的最後一個 std::locale 物件被銷燬時,實現會銷燬該方面。否則,該物件不會被銷燬。

引數

name - 區域設定的名稱
refs - 連結到 facet 的引用計數

std::collate_byname::~collate_byname

protected:
~collate_byname();

銷燬 facet。

繼承自 std::collate

巢狀型別

型別 定義
char_type CharT
string_type std::basic_string<CharT>

[編輯] 資料成員

成員 描述
std::locale::id id [static] facet 的識別符號

成員函式

呼叫 do_compare
(std::collate<CharT> 的公有成員函式) [編輯]
呼叫 do_transform
(std::collate<CharT> 的公有成員函式) [編輯]
呼叫 do_hash
(std::collate<CharT> 的公有成員函式) [編輯]

受保護的成員函式

[虛擬函式]
使用此 facet 的排序規則比較兩個字串
(std::collate<CharT> 的虛保護成員函式) [編輯]
[虛擬函式]
轉換字串,以便整理可以透過比較來替代
(std::collate<CharT> 的虛保護成員函式) [編輯]
[虛擬函式]
使用此方面的整理規則生成整數雜湊值
(std::collate<CharT> 的虛保護成員函式) [編輯]

[編輯] 注意

整理順序是字典順序:字母在國家字母表中的位置(其 *等價類*)比其大小寫或變體具有更高的優先順序。在等價類中,小寫字元排在大寫字元之前,並且特定於語言環境的順序可能適用於帶有變音符號的字元。在某些語言環境中,字元組作為一個 *整理單元* 進行比較。例如,捷克語中的 "ch""h" 之後,在 "i" 之前;匈牙利語中的 "dzs""dz" 之後,在 "g" 之前。

[編輯] 示例

[編輯] 參閱

定義字串的詞法比較和雜湊
(類模板) [編輯]
根據當前區域設定比較兩個字串
(函式) [編輯]
根據當前語言環境比較兩個寬字串
(函式) [編輯]
使用此區域設定的 collate facet 對兩個字串進行字典比較
(std::locale 的公有成員函式) [編輯]