tmp/tmplrryl4ci/{from.md → to.md}
RENAMED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
#### `basic_string::compare` <a id="string::compare">[[string::compare]]</a>
|
| 2 |
-
|
| 3 |
-
``` cpp
|
| 4 |
-
int compare(const basic_string& str) const noexcept;
|
| 5 |
-
```
|
| 6 |
-
|
| 7 |
-
*Effects:* Determines the effective length *rlen* of the strings to
|
| 8 |
-
compare as the smallest of `size()` and `str.size()`. The function then
|
| 9 |
-
compares the two strings by calling
|
| 10 |
-
`traits::compare(data(), str.data(), rlen)`.
|
| 11 |
-
|
| 12 |
-
*Returns:* The nonzero result if the result of the comparison is
|
| 13 |
-
nonzero. Otherwise, returns a value as indicated in
|
| 14 |
-
Table [[tab:strings.compare]].
|
| 15 |
-
|
| 16 |
-
**Table: `compare()` results** <a id="tab:strings.compare">[tab:strings.compare]</a>
|
| 17 |
-
|
| 18 |
-
| Condition | Return Value |
|
| 19 |
-
| ---------------------- | ------------ |
|
| 20 |
-
| `size() < str.size()` | `< 0` |
|
| 21 |
-
| `size() == str.size()` | ` 0` |
|
| 22 |
-
| `size() > str.size()` | `> 0` |
|
| 23 |
-
|
| 24 |
-
``` cpp
|
| 25 |
-
int compare(size_type pos1, size_type n1,
|
| 26 |
-
const basic_string& str) const;
|
| 27 |
-
```
|
| 28 |
-
|
| 29 |
-
*Returns:* `basic_string(*this,pos1,n1).compare(str)`.
|
| 30 |
-
|
| 31 |
-
``` cpp
|
| 32 |
-
int compare(size_type pos1, size_type n1,
|
| 33 |
-
const basic_string& str,
|
| 34 |
-
size_type pos2, size_type n2 = npos) const;
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
*Returns:*
|
| 38 |
-
`basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2))`.
|
| 39 |
-
|
| 40 |
-
``` cpp
|
| 41 |
-
int compare(const charT* s) const;
|
| 42 |
-
```
|
| 43 |
-
|
| 44 |
-
*Returns:* `compare(basic_string(s))`.
|
| 45 |
-
|
| 46 |
-
``` cpp
|
| 47 |
-
int compare(size_type pos, size_type n1,
|
| 48 |
-
const charT* s) const;
|
| 49 |
-
```
|
| 50 |
-
|
| 51 |
-
*Returns:* `basic_string(*this, pos, n1).compare(basic_string(s))`.
|
| 52 |
-
|
| 53 |
-
``` cpp
|
| 54 |
-
int compare(size_type pos, size_type n1,
|
| 55 |
-
const charT* s, size_type n2) const;
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
*Returns:* `basic_string(*this, pos, n1).compare(basic_string(s, n2))`.
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|