From Jason Turner

[cmp.categories]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpyk3msjvr/{from.md → to.md} +15 -21
tmp/tmpyk3msjvr/{from.md → to.md} RENAMED
@@ -7,13 +7,11 @@ collectively termed the *comparison category types*. Each is specified
7
  in terms of an exposition-only data member named `value` whose value
8
  typically corresponds to that of an enumerator from one of the following
9
  exposition-only enumerations:
10
 
11
  ``` cpp
12
- enum class eq { equal = 0, equivalent = equal,
13
- nonequal = 1, nonequivalent = nonequal }; // exposition only
14
- enum class ord { less = -1, greater = 1 }; // exposition only
15
  enum class ncmp { unordered = -127 }; // exposition only
16
  ```
17
 
18
  [*Note 1*: The type `strong_ordering` corresponds to the term total
19
  ordering in mathematics. — *end note*]
@@ -40,24 +38,22 @@ where `f` denotes a function that reads only comparison-salient state
40
  that is accessible via the argument’s public const members.
41
 
42
  #### Class `partial_ordering` <a id="cmp.partialord">[[cmp.partialord]]</a>
43
 
44
  The `partial_ordering` type is typically used as the result type of a
45
- three-way comparison operator [[expr.spaceship]] that (a) admits all of
46
- the six two-way comparison operators ([[expr.rel]], [[expr.eq]]), (b)
47
- does not imply substitutability, and (c) permits two values to be
48
- incomparable. [^34]
49
 
50
  ``` cpp
51
  namespace std {
52
  class partial_ordering {
53
  int value; // exposition only
54
  bool is_ordered; // exposition only
55
 
56
  // exposition-only constructors
57
- constexpr explicit
58
- partial_ordering(eq v) noexcept : value(int(v)), is_ordered(true) {} // exposition only
59
  constexpr explicit
60
  partial_ordering(ord v) noexcept : value(int(v)), is_ordered(true) {} // exposition only
61
  constexpr explicit
62
  partial_ordering(ncmp v) noexcept : value(int(v)), is_ordered(false) {} // exposition only
63
 
@@ -83,11 +79,11 @@ namespace std {
83
  friend constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept;
84
  };
85
 
86
  // valid values' definitions
87
  inline constexpr partial_ordering partial_ordering::less(ord::less);
88
- inline constexpr partial_ordering partial_ordering::equivalent(eq::equivalent);
89
  inline constexpr partial_ordering partial_ordering::greater(ord::greater);
90
  inline constexpr partial_ordering partial_ordering::unordered(ncmp::unordered);
91
  }
92
  ```
93
 
@@ -124,21 +120,20 @@ constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept
124
  `v < 0 ? partial_ordering::greater : v > 0 ? partial_ordering::less : v`.
125
 
126
  #### Class `weak_ordering` <a id="cmp.weakord">[[cmp.weakord]]</a>
127
 
128
  The `weak_ordering` type is typically used as the result type of a
129
- three-way comparison operator [[expr.spaceship]] that (a) admits all of
130
- the six two-way comparison operators ([[expr.rel]], [[expr.eq]]), and
131
- (b) does not imply substitutability.
132
 
133
  ``` cpp
134
  namespace std {
135
  class weak_ordering {
136
  int value; // exposition only
137
 
138
  // exposition-only constructors
139
- constexpr explicit weak_ordering(eq v) noexcept : value(int(v)) {} // exposition only
140
  constexpr explicit weak_ordering(ord v) noexcept : value(int(v)) {} // exposition only
141
 
142
  public:
143
  // valid values
144
  static const weak_ordering less;
@@ -163,11 +158,11 @@ namespace std {
163
  friend constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;
164
  };
165
 
166
  // valid values' definitions
167
  inline constexpr weak_ordering weak_ordering::less(ord::less);
168
- inline constexpr weak_ordering weak_ordering::equivalent(eq::equivalent);
169
  inline constexpr weak_ordering weak_ordering::greater(ord::greater);
170
  }
171
  ```
172
 
173
  ``` cpp
@@ -215,21 +210,20 @@ constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;
215
  `v < 0 ? weak_ordering::greater : v > 0 ? weak_ordering::less : v`.
216
 
217
  #### Class `strong_ordering` <a id="cmp.strongord">[[cmp.strongord]]</a>
218
 
219
  The `strong_ordering` type is typically used as the result type of a
220
- three-way comparison operator [[expr.spaceship]] that (a) admits all of
221
- the six two-way comparison operators ([[expr.rel]], [[expr.eq]]), and
222
- (b) does imply substitutability.
223
 
224
  ``` cpp
225
  namespace std {
226
  class strong_ordering {
227
  int value; // exposition only
228
 
229
  // exposition-only constructors
230
- constexpr explicit strong_ordering(eq v) noexcept : value(int(v)) {} // exposition only
231
  constexpr explicit strong_ordering(ord v) noexcept : value(int(v)) {} // exposition only
232
 
233
  public:
234
  // valid values
235
  static const strong_ordering less;
@@ -256,12 +250,12 @@ namespace std {
256
  friend constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept;
257
  };
258
 
259
  // valid values' definitions
260
  inline constexpr strong_ordering strong_ordering::less(ord::less);
261
- inline constexpr strong_ordering strong_ordering::equal(eq::equal);
262
- inline constexpr strong_ordering strong_ordering::equivalent(eq::equivalent);
263
  inline constexpr strong_ordering strong_ordering::greater(ord::greater);
264
  }
265
  ```
266
 
267
  ``` cpp
 
7
  in terms of an exposition-only data member named `value` whose value
8
  typically corresponds to that of an enumerator from one of the following
9
  exposition-only enumerations:
10
 
11
  ``` cpp
12
+ enum class ord { equal = 0, equivalent = equal, less = -1, greater = 1 }; // exposition only
 
 
13
  enum class ncmp { unordered = -127 }; // exposition only
14
  ```
15
 
16
  [*Note 1*: The type `strong_ordering` corresponds to the term total
17
  ordering in mathematics. — *end note*]
 
38
  that is accessible via the argument’s public const members.
39
 
40
  #### Class `partial_ordering` <a id="cmp.partialord">[[cmp.partialord]]</a>
41
 
42
  The `partial_ordering` type is typically used as the result type of a
43
+ three-way comparison operator [[expr.spaceship]] for a type that admits
44
+ all of the six two-way comparison operators [[expr.rel]], [[expr.eq]],
45
+ for which equality need not imply substitutability, and that permits two
46
+ values to be incomparable.[^32]
47
 
48
  ``` cpp
49
  namespace std {
50
  class partial_ordering {
51
  int value; // exposition only
52
  bool is_ordered; // exposition only
53
 
54
  // exposition-only constructors
 
 
55
  constexpr explicit
56
  partial_ordering(ord v) noexcept : value(int(v)), is_ordered(true) {} // exposition only
57
  constexpr explicit
58
  partial_ordering(ncmp v) noexcept : value(int(v)), is_ordered(false) {} // exposition only
59
 
 
79
  friend constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept;
80
  };
81
 
82
  // valid values' definitions
83
  inline constexpr partial_ordering partial_ordering::less(ord::less);
84
+ inline constexpr partial_ordering partial_ordering::equivalent(ord::equivalent);
85
  inline constexpr partial_ordering partial_ordering::greater(ord::greater);
86
  inline constexpr partial_ordering partial_ordering::unordered(ncmp::unordered);
87
  }
88
  ```
89
 
 
120
  `v < 0 ? partial_ordering::greater : v > 0 ? partial_ordering::less : v`.
121
 
122
  #### Class `weak_ordering` <a id="cmp.weakord">[[cmp.weakord]]</a>
123
 
124
  The `weak_ordering` type is typically used as the result type of a
125
+ three-way comparison operator [[expr.spaceship]] for a type that admits
126
+ all of the six two-way comparison operators [[expr.rel]], [[expr.eq]]
127
+ and for which equality need not imply substitutability.
128
 
129
  ``` cpp
130
  namespace std {
131
  class weak_ordering {
132
  int value; // exposition only
133
 
134
  // exposition-only constructors
 
135
  constexpr explicit weak_ordering(ord v) noexcept : value(int(v)) {} // exposition only
136
 
137
  public:
138
  // valid values
139
  static const weak_ordering less;
 
158
  friend constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;
159
  };
160
 
161
  // valid values' definitions
162
  inline constexpr weak_ordering weak_ordering::less(ord::less);
163
+ inline constexpr weak_ordering weak_ordering::equivalent(ord::equivalent);
164
  inline constexpr weak_ordering weak_ordering::greater(ord::greater);
165
  }
166
  ```
167
 
168
  ``` cpp
 
210
  `v < 0 ? weak_ordering::greater : v > 0 ? weak_ordering::less : v`.
211
 
212
  #### Class `strong_ordering` <a id="cmp.strongord">[[cmp.strongord]]</a>
213
 
214
  The `strong_ordering` type is typically used as the result type of a
215
+ three-way comparison operator [[expr.spaceship]] for a type that admits
216
+ all of the six two-way comparison operators [[expr.rel]], [[expr.eq]]
217
+ and for which equality does imply substitutability.
218
 
219
  ``` cpp
220
  namespace std {
221
  class strong_ordering {
222
  int value; // exposition only
223
 
224
  // exposition-only constructors
 
225
  constexpr explicit strong_ordering(ord v) noexcept : value(int(v)) {} // exposition only
226
 
227
  public:
228
  // valid values
229
  static const strong_ordering less;
 
250
  friend constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept;
251
  };
252
 
253
  // valid values' definitions
254
  inline constexpr strong_ordering strong_ordering::less(ord::less);
255
+ inline constexpr strong_ordering strong_ordering::equal(ord::equal);
256
+ inline constexpr strong_ordering strong_ordering::equivalent(ord::equivalent);
257
  inline constexpr strong_ordering strong_ordering::greater(ord::greater);
258
  }
259
  ```
260
 
261
  ``` cpp