tmp/tmpvx5fuqn0/{from.md → to.md}
RENAMED
|
@@ -36,34 +36,38 @@ Then:
|
|
| 36 |
|
| 37 |
If both operands have the same enumeration type `E`, the operator yields
|
| 38 |
the result of converting the operands to the underlying type of `E` and
|
| 39 |
applying `<=>` to the converted operands.
|
| 40 |
|
| 41 |
-
If at least one of the operands is of pointer type and the other
|
| 42 |
-
is of pointer or array type, array-to-pointer conversions
|
| 43 |
[[conv.array]], pointer conversions [[conv.ptr]], and qualification
|
| 44 |
conversions [[conv.qual]] are performed on both operands to bring them
|
| 45 |
to their composite pointer type [[expr.type]]. After the conversions,
|
| 46 |
the operands shall have the same type.
|
| 47 |
|
| 48 |
[*Note 1*: If both of the operands are arrays, array-to-pointer
|
| 49 |
conversions [[conv.array]] are not applied. — *end note*]
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
`p` and `q` compare
|
|
|
|
|
|
|
| 55 |
`std::strong_ordering::less` if `q` compares greater than `p` and
|
| 56 |
`std::strong_ordering::greater` if `p` compares greater than `q`
|
| 57 |
-
[[expr.rel]]
|
|
|
|
| 58 |
|
| 59 |
Otherwise, the program is ill-formed.
|
| 60 |
|
| 61 |
The three comparison category types [[cmp.categories]] (the types
|
| 62 |
`std::strong_ordering`, `std::weak_ordering`, and
|
| 63 |
-
`std::partial_ordering`) are not predefined; if
|
| 64 |
-
|
| 65 |
-
|
|
|
|
| 66 |
specifier [[dcl.spec.auto]] in a defaulted three-way comparison
|
| 67 |
-
[[class.spaceship]] or use of the built-in operator)
|
| 68 |
ill-formed.
|
| 69 |
|
|
|
|
| 36 |
|
| 37 |
If both operands have the same enumeration type `E`, the operator yields
|
| 38 |
the result of converting the operands to the underlying type of `E` and
|
| 39 |
applying `<=>` to the converted operands.
|
| 40 |
|
| 41 |
+
If at least one of the operands is of object pointer type and the other
|
| 42 |
+
operand is of object pointer or array type, array-to-pointer conversions
|
| 43 |
[[conv.array]], pointer conversions [[conv.ptr]], and qualification
|
| 44 |
conversions [[conv.qual]] are performed on both operands to bring them
|
| 45 |
to their composite pointer type [[expr.type]]. After the conversions,
|
| 46 |
the operands shall have the same type.
|
| 47 |
|
| 48 |
[*Note 1*: If both of the operands are arrays, array-to-pointer
|
| 49 |
conversions [[conv.array]] are not applied. — *end note*]
|
| 50 |
|
| 51 |
+
In this case, `p <=> q` is of type `std::strong_ordering` and the result
|
| 52 |
+
is defined by the following rules:
|
| 53 |
+
|
| 54 |
+
- If two pointer operands `p` and `q` compare equal [[expr.eq]],
|
| 55 |
+
`p <=> q` yields `std::strong_ordering::equal`;
|
| 56 |
+
- otherwise, if `p` and `q` compare unequal, `p <=> q` yields
|
| 57 |
`std::strong_ordering::less` if `q` compares greater than `p` and
|
| 58 |
`std::strong_ordering::greater` if `p` compares greater than `q`
|
| 59 |
+
[[expr.rel]];
|
| 60 |
+
- otherwise, the result is unspecified.
|
| 61 |
|
| 62 |
Otherwise, the program is ill-formed.
|
| 63 |
|
| 64 |
The three comparison category types [[cmp.categories]] (the types
|
| 65 |
`std::strong_ordering`, `std::weak_ordering`, and
|
| 66 |
+
`std::partial_ordering`) are not predefined; if a standard library
|
| 67 |
+
declaration [[compare.syn]], [[std.modules]] of such a class type does
|
| 68 |
+
not precede [[basic.lookup.general]] a use of that type — even an
|
| 69 |
+
implicit use in which the type is not named (e.g., via the `auto`
|
| 70 |
specifier [[dcl.spec.auto]] in a defaulted three-way comparison
|
| 71 |
+
[[class.spaceship]] or use of the built-in operator) — the program is
|
| 72 |
ill-formed.
|
| 73 |
|