tmp/tmp03u_d_jj/{from.md → to.md}
RENAMED
|
@@ -3,12 +3,12 @@
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template <class charT>
|
| 6 |
class collate : public locale::facet {
|
| 7 |
public:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
explicit collate(size_t refs = 0);
|
| 12 |
|
| 13 |
int compare(const charT* low1, const charT* high1,
|
| 14 |
const charT* low2, const charT* high2) const;
|
|
@@ -44,23 +44,23 @@ Each function compares a string of characters `*p` in the range \[`low`,
|
|
| 44 |
``` cpp
|
| 45 |
int compare(const charT* low1, const charT* high1,
|
| 46 |
const charT* low2, const charT* high2) const;
|
| 47 |
```
|
| 48 |
|
| 49 |
-
*Returns:* `do_compare(low1, high1, low2, high2)`
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
string_type transform(const charT* low, const charT* high) const;
|
| 53 |
```
|
| 54 |
|
| 55 |
-
*Returns:* `do_transform(low, high)`
|
| 56 |
|
| 57 |
``` cpp
|
| 58 |
long hash(const charT* low, const charT* high) const;
|
| 59 |
```
|
| 60 |
|
| 61 |
-
*Returns:* `do_hash(low, high)`
|
| 62 |
|
| 63 |
##### `collate` virtual functions <a id="locale.collate.virtuals">[[locale.collate.virtuals]]</a>
|
| 64 |
|
| 65 |
``` cpp
|
| 66 |
int do_compare(const charT* low1, const charT* high1,
|
|
@@ -78,17 +78,19 @@ string_type do_transform(const charT* low, const charT* high) const;
|
|
| 78 |
```
|
| 79 |
|
| 80 |
*Returns:* A `basic_string<charT>` value that, compared
|
| 81 |
lexicographically with the result of calling `transform()` on another
|
| 82 |
string, yields the same result as calling `do_compare()` on the same two
|
| 83 |
-
strings.[^
|
| 84 |
|
| 85 |
``` cpp
|
| 86 |
long do_hash(const charT* low, const charT* high) const;
|
| 87 |
```
|
| 88 |
|
| 89 |
*Returns:* An integer value equal to the result of calling `hash()` on
|
| 90 |
any other string for which `do_compare()` returns 0 (equal) when passed
|
| 91 |
-
the two strings.
|
|
|
|
|
|
|
| 92 |
string which does not compare equal should be very small, approaching
|
| 93 |
-
`(1.0/numeric_limits<unsigned long>::max())`.
|
| 94 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template <class charT>
|
| 6 |
class collate : public locale::facet {
|
| 7 |
public:
|
| 8 |
+
using char_type = charT;
|
| 9 |
+
using string_type = basic_string<charT>;
|
| 10 |
|
| 11 |
explicit collate(size_t refs = 0);
|
| 12 |
|
| 13 |
int compare(const charT* low1, const charT* high1,
|
| 14 |
const charT* low2, const charT* high2) const;
|
|
|
|
| 44 |
``` cpp
|
| 45 |
int compare(const charT* low1, const charT* high1,
|
| 46 |
const charT* low2, const charT* high2) const;
|
| 47 |
```
|
| 48 |
|
| 49 |
+
*Returns:* `do_compare(low1, high1, low2, high2)`.
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
string_type transform(const charT* low, const charT* high) const;
|
| 53 |
```
|
| 54 |
|
| 55 |
+
*Returns:* `do_transform(low, high)`.
|
| 56 |
|
| 57 |
``` cpp
|
| 58 |
long hash(const charT* low, const charT* high) const;
|
| 59 |
```
|
| 60 |
|
| 61 |
+
*Returns:* `do_hash(low, high)`.
|
| 62 |
|
| 63 |
##### `collate` virtual functions <a id="locale.collate.virtuals">[[locale.collate.virtuals]]</a>
|
| 64 |
|
| 65 |
``` cpp
|
| 66 |
int do_compare(const charT* low1, const charT* high1,
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
*Returns:* A `basic_string<charT>` value that, compared
|
| 81 |
lexicographically with the result of calling `transform()` on another
|
| 82 |
string, yields the same result as calling `do_compare()` on the same two
|
| 83 |
+
strings.[^14]
|
| 84 |
|
| 85 |
``` cpp
|
| 86 |
long do_hash(const charT* low, const charT* high) const;
|
| 87 |
```
|
| 88 |
|
| 89 |
*Returns:* An integer value equal to the result of calling `hash()` on
|
| 90 |
any other string for which `do_compare()` returns 0 (equal) when passed
|
| 91 |
+
the two strings.
|
| 92 |
+
|
| 93 |
+
[*Note 1*: 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())`. — *end note*]
|
| 96 |
|