tmp/tmpb96nnao8/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Three-way comparison algorithms <a id="alg.three.way">[[alg.three.way]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class InputIterator1, class InputIterator2, class Cmp>
|
| 5 |
+
constexpr auto
|
| 6 |
+
lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
|
| 7 |
+
InputIterator2 b2, InputIterator2 e2,
|
| 8 |
+
Cmp comp)
|
| 9 |
+
-> decltype(comp(*b1, *b2));
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
*Mandates:* `decltype(comp(*b1, *b2))` is a comparison category type.
|
| 13 |
+
|
| 14 |
+
*Effects:* Lexicographically compares two ranges and produces a result
|
| 15 |
+
of the strongest applicable comparison category type. Equivalent to:
|
| 16 |
+
|
| 17 |
+
``` cpp
|
| 18 |
+
for ( ; b1 != e1 && b2 != e2; void(++b1), void(++b2) )
|
| 19 |
+
if (auto cmp = comp(*b1,*b2); cmp != 0)
|
| 20 |
+
return cmp;
|
| 21 |
+
return b1 != e1 ? strong_ordering::greater :
|
| 22 |
+
b2 != e2 ? strong_ordering::less :
|
| 23 |
+
strong_ordering::equal;
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
``` cpp
|
| 27 |
+
template<class InputIterator1, class InputIterator2>
|
| 28 |
+
constexpr auto
|
| 29 |
+
lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
|
| 30 |
+
InputIterator2 b2, InputIterator2 e2);
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
*Effects:* Equivalent to:
|
| 34 |
+
|
| 35 |
+
``` cpp
|
| 36 |
+
return lexicographical_compare_three_way(b1, e1, b2, e2, compare_three_way());
|
| 37 |
+
```
|
| 38 |
+
|