From Jason Turner

[cmp.strongord]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmprn8szcdo/{from.md → to.md} +106 -0
tmp/tmprn8szcdo/{from.md → to.md} RENAMED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `strong_ordering` <a id="cmp.strongord">[[cmp.strongord]]</a>
2
+
3
+ The `strong_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]]), and
6
+ (b) does imply substitutability.
7
+
8
+ ``` cpp
9
+ namespace std {
10
+ class strong_ordering {
11
+ int value; // exposition only
12
+
13
+ // exposition-only constructors
14
+ constexpr explicit strong_ordering(eq v) noexcept : value(int(v)) {} // exposition only
15
+ constexpr explicit strong_ordering(ord v) noexcept : value(int(v)) {} // exposition only
16
+
17
+ public:
18
+ // valid values
19
+ static const strong_ordering less;
20
+ static const strong_ordering equal;
21
+ static const strong_ordering equivalent;
22
+ static const strong_ordering greater;
23
+
24
+ // conversions
25
+ constexpr operator partial_ordering() const noexcept;
26
+ constexpr operator weak_ordering() const noexcept;
27
+
28
+ // comparisons
29
+ friend constexpr bool operator==(strong_ordering v, unspecified) noexcept;
30
+ friend constexpr bool operator==(strong_ordering v, strong_ordering w) noexcept = default;
31
+ friend constexpr bool operator< (strong_ordering v, unspecified) noexcept;
32
+ friend constexpr bool operator> (strong_ordering v, unspecified) noexcept;
33
+ friend constexpr bool operator<=(strong_ordering v, unspecified) noexcept;
34
+ friend constexpr bool operator>=(strong_ordering v, unspecified) noexcept;
35
+ friend constexpr bool operator< (unspecified, strong_ordering v) noexcept;
36
+ friend constexpr bool operator> (unspecified, strong_ordering v) noexcept;
37
+ friend constexpr bool operator<=(unspecified, strong_ordering v) noexcept;
38
+ friend constexpr bool operator>=(unspecified, strong_ordering v) noexcept;
39
+ friend constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept;
40
+ friend constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept;
41
+ };
42
+
43
+ // valid values' definitions
44
+ inline constexpr strong_ordering strong_ordering::less(ord::less);
45
+ inline constexpr strong_ordering strong_ordering::equal(eq::equal);
46
+ inline constexpr strong_ordering strong_ordering::equivalent(eq::equivalent);
47
+ inline constexpr strong_ordering strong_ordering::greater(ord::greater);
48
+ }
49
+ ```
50
+
51
+ ``` cpp
52
+ constexpr operator partial_ordering() const noexcept;
53
+ ```
54
+
55
+ *Returns:*
56
+
57
+ ``` cpp
58
+ value == 0 ? partial_ordering::equivalent :
59
+ value < 0 ? partial_ordering::less :
60
+ partial_ordering::greater
61
+ ```
62
+
63
+ ``` cpp
64
+ constexpr operator weak_ordering() const noexcept;
65
+ ```
66
+
67
+ *Returns:*
68
+
69
+ ``` cpp
70
+ value == 0 ? weak_ordering::equivalent :
71
+ value < 0 ? weak_ordering::less :
72
+ weak_ordering::greater
73
+ ```
74
+
75
+ ``` cpp
76
+ constexpr bool operator==(strong_ordering v, unspecified) noexcept;
77
+ constexpr bool operator< (strong_ordering v, unspecified) noexcept;
78
+ constexpr bool operator> (strong_ordering v, unspecified) noexcept;
79
+ constexpr bool operator<=(strong_ordering v, unspecified) noexcept;
80
+ constexpr bool operator>=(strong_ordering v, unspecified) noexcept;
81
+ ```
82
+
83
+ *Returns:* `v.value 0` for `operator`.
84
+
85
+ ``` cpp
86
+ constexpr bool operator< (unspecified, strong_ordering v) noexcept;
87
+ constexpr bool operator> (unspecified, strong_ordering v) noexcept;
88
+ constexpr bool operator<=(unspecified, strong_ordering v) noexcept;
89
+ constexpr bool operator>=(unspecified, strong_ordering v) noexcept;
90
+ ```
91
+
92
+ *Returns:* `0 v.value` for `operator`.
93
+
94
+ ``` cpp
95
+ constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept;
96
+ ```
97
+
98
+ *Returns:* `v`.
99
+
100
+ ``` cpp
101
+ constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept;
102
+ ```
103
+
104
+ *Returns:*
105
+ `v < 0 ? strong_ordering::greater : v > 0 ? strong_ordering::less : v`.
106
+