tmp/tmphec4qb1y/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class `partial_ordering` <a id="cmp.partialord">[[cmp.partialord]]</a>
|
| 2 |
+
|
| 3 |
+
The `partial_ordering` type is typically used as the result type of a
|
| 4 |
+
three-way comparison operator [[expr.spaceship]] that (a) admits all of
|
| 5 |
+
the six two-way comparison operators ([[expr.rel]], [[expr.eq]]), (b)
|
| 6 |
+
does not imply substitutability, and (c) permits two values to be
|
| 7 |
+
incomparable. [^34]
|
| 8 |
+
|
| 9 |
+
``` cpp
|
| 10 |
+
namespace std {
|
| 11 |
+
class partial_ordering {
|
| 12 |
+
int value; // exposition only
|
| 13 |
+
bool is_ordered; // exposition only
|
| 14 |
+
|
| 15 |
+
// exposition-only constructors
|
| 16 |
+
constexpr explicit
|
| 17 |
+
partial_ordering(eq v) noexcept : value(int(v)), is_ordered(true) {} // exposition only
|
| 18 |
+
constexpr explicit
|
| 19 |
+
partial_ordering(ord v) noexcept : value(int(v)), is_ordered(true) {} // exposition only
|
| 20 |
+
constexpr explicit
|
| 21 |
+
partial_ordering(ncmp v) noexcept : value(int(v)), is_ordered(false) {} // exposition only
|
| 22 |
+
|
| 23 |
+
public:
|
| 24 |
+
// valid values
|
| 25 |
+
static const partial_ordering less;
|
| 26 |
+
static const partial_ordering equivalent;
|
| 27 |
+
static const partial_ordering greater;
|
| 28 |
+
static const partial_ordering unordered;
|
| 29 |
+
|
| 30 |
+
// comparisons
|
| 31 |
+
friend constexpr bool operator==(partial_ordering v, unspecified) noexcept;
|
| 32 |
+
friend constexpr bool operator==(partial_ordering v, partial_ordering w) noexcept = default;
|
| 33 |
+
friend constexpr bool operator< (partial_ordering v, unspecified) noexcept;
|
| 34 |
+
friend constexpr bool operator> (partial_ordering v, unspecified) noexcept;
|
| 35 |
+
friend constexpr bool operator<=(partial_ordering v, unspecified) noexcept;
|
| 36 |
+
friend constexpr bool operator>=(partial_ordering v, unspecified) noexcept;
|
| 37 |
+
friend constexpr bool operator< (unspecified, partial_ordering v) noexcept;
|
| 38 |
+
friend constexpr bool operator> (unspecified, partial_ordering v) noexcept;
|
| 39 |
+
friend constexpr bool operator<=(unspecified, partial_ordering v) noexcept;
|
| 40 |
+
friend constexpr bool operator>=(unspecified, partial_ordering v) noexcept;
|
| 41 |
+
friend constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept;
|
| 42 |
+
friend constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept;
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
// valid values' definitions
|
| 46 |
+
inline constexpr partial_ordering partial_ordering::less(ord::less);
|
| 47 |
+
inline constexpr partial_ordering partial_ordering::equivalent(eq::equivalent);
|
| 48 |
+
inline constexpr partial_ordering partial_ordering::greater(ord::greater);
|
| 49 |
+
inline constexpr partial_ordering partial_ordering::unordered(ncmp::unordered);
|
| 50 |
+
}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
``` cpp
|
| 54 |
+
constexpr bool operator==(partial_ordering v, unspecified) noexcept;
|
| 55 |
+
constexpr bool operator< (partial_ordering v, unspecified) noexcept;
|
| 56 |
+
constexpr bool operator> (partial_ordering v, unspecified) noexcept;
|
| 57 |
+
constexpr bool operator<=(partial_ordering v, unspecified) noexcept;
|
| 58 |
+
constexpr bool operator>=(partial_ordering v, unspecified) noexcept;
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
*Returns:* For `operator`, `v.is_ordered && v.value 0`.
|
| 62 |
+
|
| 63 |
+
``` cpp
|
| 64 |
+
constexpr bool operator< (unspecified, partial_ordering v) noexcept;
|
| 65 |
+
constexpr bool operator> (unspecified, partial_ordering v) noexcept;
|
| 66 |
+
constexpr bool operator<=(unspecified, partial_ordering v) noexcept;
|
| 67 |
+
constexpr bool operator>=(unspecified, partial_ordering v) noexcept;
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
*Returns:* For `operator`, `v.is_ordered && 0 v.value`.
|
| 71 |
+
|
| 72 |
+
``` cpp
|
| 73 |
+
constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept;
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
*Returns:* `v`.
|
| 77 |
+
|
| 78 |
+
``` cpp
|
| 79 |
+
constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept;
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
*Returns:*
|
| 83 |
+
`v < 0 ? partial_ordering::greater : v > 0 ? partial_ordering::less : v`.
|
| 84 |
+
|