Init
This commit is contained in:
15
cppdraft/locale/collate/byname.md
Normal file
15
cppdraft/locale/collate/byname.md
Normal file
@@ -0,0 +1,15 @@
|
||||
[locale.collate.byname]
|
||||
|
||||
# 28 Text processing library [[text]](./#text)
|
||||
|
||||
## 28.3 Localization library [[localization]](localization#locale.collate.byname)
|
||||
|
||||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.collate.byname)
|
||||
|
||||
#### 28.3.4.5 The collate category [[category.collate]](category.collate#locale.collate.byname)
|
||||
|
||||
#### 28.3.4.5.2 Class template collate_byname [locale.collate.byname]
|
||||
|
||||
[ð](#lib:collate_byname)
|
||||
|
||||
namespace std {template<class charT>class collate_byname : public collate<charT> {public:using string_type = basic_string<charT>; explicit collate_byname(const char*, size_t refs = 0); explicit collate_byname(const string&, size_t refs = 0); protected:~collate_byname(); };}
|
||||
41
cppdraft/locale/collate/general.md
Normal file
41
cppdraft/locale/collate/general.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[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)
|
||||
47
cppdraft/locale/collate/members.md
Normal file
47
cppdraft/locale/collate/members.md
Normal file
@@ -0,0 +1,47 @@
|
||||
[locale.collate.members]
|
||||
|
||||
# 28 Text processing library [[text]](./#text)
|
||||
|
||||
## 28.3 Localization library [[localization]](localization#locale.collate.members)
|
||||
|
||||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.collate.members)
|
||||
|
||||
#### 28.3.4.5 The collate category [[category.collate]](category.collate#locale.collate.members)
|
||||
|
||||
#### 28.3.4.5.1 Class template collate [[locale.collate]](locale.collate#members)
|
||||
|
||||
#### 28.3.4.5.1.2 Members [locale.collate.members]
|
||||
|
||||
[ð](#lib:collate,compare)
|
||||
|
||||
`int compare(const charT* low1, const charT* high1,
|
||||
const charT* low2, const charT* high2) const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3406)
|
||||
|
||||
*Returns*: do_compare(low1, high1, low2, high2)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:collate,transform)
|
||||
|
||||
`string_type transform(const charT* low, const charT* high) const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3417)
|
||||
|
||||
*Returns*: do_transform(low, high)[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:collate,hash)
|
||||
|
||||
`long hash(const charT* low, const charT* high) const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3428)
|
||||
|
||||
*Returns*: do_hash(low, high)[.](#3.sentence-1)
|
||||
69
cppdraft/locale/collate/virtuals.md
Normal file
69
cppdraft/locale/collate/virtuals.md
Normal file
@@ -0,0 +1,69 @@
|
||||
[locale.collate.virtuals]
|
||||
|
||||
# 28 Text processing library [[text]](./#text)
|
||||
|
||||
## 28.3 Localization library [[localization]](localization#locale.collate.virtuals)
|
||||
|
||||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.collate.virtuals)
|
||||
|
||||
#### 28.3.4.5 The collate category [[category.collate]](category.collate#locale.collate.virtuals)
|
||||
|
||||
#### 28.3.4.5.1 Class template collate [[locale.collate]](locale.collate#virtuals)
|
||||
|
||||
#### 28.3.4.5.1.3 Virtual functions [locale.collate.virtuals]
|
||||
|
||||
[ð](#lib:collate,do_compare)
|
||||
|
||||
`int do_compare(const charT* low1, const charT* high1,
|
||||
const charT* low2, const charT* high2) const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3442)
|
||||
|
||||
*Returns*: 1 if the first string is greater than the second,-1 if less,
|
||||
zero otherwise[.](#1.sentence-1)
|
||||
|
||||
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>,
|
||||
implement a lexicographical comparison ([[alg.lex.comparison]](alg.lex.comparison "26.8.11 Lexicographical comparison"))[.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:collate,do_transform)
|
||||
|
||||
`string_type do_transform(const charT* low, const charT* high) const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3459)
|
||||
|
||||
*Returns*: A basic_string<charT> value that,
|
||||
compared lexicographically with
|
||||
the result of calling transform() on another string,
|
||||
yields the same result as calling do_compare() on the same two strings[.](#2.sentence-1)[226](#footnote-226 "This function is useful when one string is being compared to many other strings.")
|
||||
|
||||
[ð](#lib:collate,do_hash)
|
||||
|
||||
`long do_hash(const charT* low, const charT* high) const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3476)
|
||||
|
||||
*Returns*: An integer value equal to the result of calling hash() on any other string for which do_compare() returns 0 (equal)
|
||||
when passed the two strings[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3482)
|
||||
|
||||
*Recommended practice*: The probability that the result equals that for another string
|
||||
which does not compare equal should be very small,
|
||||
approaching (1.0/numeric_limits<unsigned long>::max())[.](#4.sentence-1)
|
||||
|
||||
[226)](#footnote-226)[226)](#footnoteref-226)
|
||||
|
||||
This function is useful when one string is being compared to many other strings[.](#footnote-226.sentence-1)
|
||||
Reference in New Issue
Block a user