From Jason Turner

[category.collate]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp30f3mjuq/{from.md → to.md} +12 -9
tmp/tmp30f3mjuq/{from.md → to.md} RENAMED
@@ -5,12 +5,12 @@
5
  ``` cpp
6
  namespace std {
7
  template <class charT>
8
  class collate : public locale::facet {
9
  public:
10
- typedef charT char_type;
11
- typedef basic_string<charT> string_type;
12
 
13
  explicit collate(size_t refs = 0);
14
 
15
  int compare(const charT* low1, const charT* high1,
16
  const charT* low2, const charT* high2) const;
@@ -46,23 +46,23 @@ Each function compares a string of characters `*p` in the range \[`low`,
46
  ``` cpp
47
  int compare(const charT* low1, const charT* high1,
48
  const charT* low2, const charT* high2) const;
49
  ```
50
 
51
- *Returns:* `do_compare(low1, high1, low2, high2)`
52
 
53
  ``` cpp
54
  string_type transform(const charT* low, const charT* high) const;
55
  ```
56
 
57
- *Returns:* `do_transform(low, high)`
58
 
59
  ``` cpp
60
  long hash(const charT* low, const charT* high) const;
61
  ```
62
 
63
- *Returns:* `do_hash(low, high)`
64
 
65
  ##### `collate` virtual functions <a id="locale.collate.virtuals">[[locale.collate.virtuals]]</a>
66
 
67
  ``` cpp
68
  int do_compare(const charT* low1, const charT* high1,
@@ -80,30 +80,33 @@ string_type do_transform(const charT* low, const charT* high) const;
80
  ```
81
 
82
  *Returns:* A `basic_string<charT>` value that, compared
83
  lexicographically with the result of calling `transform()` on another
84
  string, yields the same result as calling `do_compare()` on the same two
85
- strings.[^13]
86
 
87
  ``` cpp
88
  long do_hash(const charT* low, const charT* high) const;
89
  ```
90
 
91
  *Returns:* An integer value equal to the result of calling `hash()` on
92
  any other string for which `do_compare()` returns 0 (equal) when passed
93
- the two strings. The probability that the result equals that for another
 
 
94
  string which does not compare equal should be very small, approaching
95
- `(1.0/numeric_limits<unsigned long>::max())`.
96
 
97
  #### Class template `collate_byname` <a id="locale.collate.byname">[[locale.collate.byname]]</a>
98
 
99
  ``` cpp
100
  namespace std {
101
  template <class charT>
102
  class collate_byname : public collate<charT> {
103
  public:
104
- typedef basic_string<charT> string_type;
 
105
  explicit collate_byname(const char*, size_t refs = 0);
106
  explicit collate_byname(const string&, size_t refs = 0);
107
  protected:
108
  ~collate_byname();
109
  };
 
5
  ``` cpp
6
  namespace std {
7
  template <class charT>
8
  class collate : public locale::facet {
9
  public:
10
+ using char_type = charT;
11
+ using string_type = basic_string<charT>;
12
 
13
  explicit collate(size_t refs = 0);
14
 
15
  int compare(const charT* low1, const charT* high1,
16
  const charT* low2, const charT* high2) const;
 
46
  ``` cpp
47
  int compare(const charT* low1, const charT* high1,
48
  const charT* low2, const charT* high2) const;
49
  ```
50
 
51
+ *Returns:* `do_compare(low1, high1, low2, high2)`.
52
 
53
  ``` cpp
54
  string_type transform(const charT* low, const charT* high) const;
55
  ```
56
 
57
+ *Returns:* `do_transform(low, high)`.
58
 
59
  ``` cpp
60
  long hash(const charT* low, const charT* high) const;
61
  ```
62
 
63
+ *Returns:* `do_hash(low, high)`.
64
 
65
  ##### `collate` virtual functions <a id="locale.collate.virtuals">[[locale.collate.virtuals]]</a>
66
 
67
  ``` cpp
68
  int do_compare(const charT* low1, const charT* high1,
 
80
  ```
81
 
82
  *Returns:* A `basic_string<charT>` value that, compared
83
  lexicographically with the result of calling `transform()` on another
84
  string, yields the same result as calling `do_compare()` on the same two
85
+ strings.[^14]
86
 
87
  ``` cpp
88
  long do_hash(const charT* low, const charT* high) const;
89
  ```
90
 
91
  *Returns:* An integer value equal to the result of calling `hash()` on
92
  any other string for which `do_compare()` returns 0 (equal) when passed
93
+ the two strings.
94
+
95
+ [*Note 1*: The probability that the result equals that for another
96
  string which does not compare equal should be very small, approaching
97
+ `(1.0/numeric_limits<unsigned long>::max())`. — *end note*]
98
 
99
  #### Class template `collate_byname` <a id="locale.collate.byname">[[locale.collate.byname]]</a>
100
 
101
  ``` cpp
102
  namespace std {
103
  template <class charT>
104
  class collate_byname : public collate<charT> {
105
  public:
106
+ using string_type = basic_string<charT>;
107
+
108
  explicit collate_byname(const char*, size_t refs = 0);
109
  explicit collate_byname(const string&, size_t refs = 0);
110
  protected:
111
  ~collate_byname();
112
  };