42 lines
2.3 KiB
Markdown
42 lines
2.3 KiB
Markdown
[locale.collate.general]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.3 Localization library [[localization]](localization#locale.collate.general)
|
||
|
||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.collate.general)
|
||
|
||
#### 28.3.4.5 The collate category [[category.collate]](category.collate#locale.collate.general)
|
||
|
||
#### 28.3.4.5.1 Class template collate [[locale.collate]](locale.collate#general)
|
||
|
||
#### 28.3.4.5.1.1 General [locale.collate.general]
|
||
|
||
[ð](#lib:collate)
|
||
|
||
namespace std {template<class charT>class collate : public locale::facet {public:using char_type = charT; using string_type = basic_string<charT>; explicit collate(size_t refs = 0); int compare(const charT* low1, const charT* high1, const charT* low2, const charT* high2) const;
|
||
string_type transform(const charT* low, const charT* high) const; long hash(const charT* low, const charT* high) const; static locale::id id; protected:~collate(); virtual int do_compare(const charT* low1, const charT* high1, const charT* low2, const charT* high2) const; virtual string_type do_transform(const charT* low, const charT* high) const; virtual long do_hash (const charT* low, const charT* high) const; };}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3381)
|
||
|
||
The class collate<charT> provides features
|
||
for use in the collation (comparison) and hashing of strings[.](#1.sentence-1)
|
||
|
||
A locale member function template, operator(),
|
||
uses the collate facet to allow a locale to act directly as
|
||
the predicate argument for standard algorithms ([[algorithms]](algorithms "26 Algorithms library")) and
|
||
containers operating on strings[.](#1.sentence-2)
|
||
|
||
The specializations
|
||
required in Table [91](locale.category#tab:locale.category.facets "Table 91: Locale category facets") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale::category")),
|
||
namely collate<char> and collate<wchar_t>,
|
||
apply lexicographical ordering ([[alg.lex.comparison]](alg.lex.comparison "26.8.11 Lexicographical comparison"))[.](#1.sentence-3)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3393)
|
||
|
||
Each function compares a string of characters *p in the range [low, high)[.](#2.sentence-1)
|