8 enum class _EqResult
: unsigned char {
13 enum class _OrdResult
: signed char {
18 enum class _NCmpResult
: signed char {
22 struct _CmpUnspecifiedType
;
23 using _CmpUnspecifiedParam
= void (_CmpUnspecifiedType::*)();
25 class partial_ordering
{
26 using _ValueT
= signed char;
27 explicit constexpr partial_ordering(_EqResult __v
) noexcept
28 : __value_(_ValueT(__v
)) {}
29 explicit constexpr partial_ordering(_OrdResult __v
) noexcept
30 : __value_(_ValueT(__v
)) {}
31 explicit constexpr partial_ordering(_NCmpResult __v
) noexcept
32 : __value_(_ValueT(__v
)) {}
34 constexpr bool __is_ordered() const noexcept
{
35 return __value_
!= _ValueT(_NCmpResult::__unordered
);
40 static const partial_ordering less
;
41 static const partial_ordering equivalent
;
42 static const partial_ordering greater
;
43 static const partial_ordering unordered
;
46 friend constexpr bool operator==(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
47 friend constexpr bool operator!=(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
48 friend constexpr bool operator<(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
49 friend constexpr bool operator<=(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
50 friend constexpr bool operator>(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
51 friend constexpr bool operator>=(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
52 friend constexpr bool operator==(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
53 friend constexpr bool operator!=(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
54 friend constexpr bool operator<(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
55 friend constexpr bool operator<=(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
56 friend constexpr bool operator>(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
57 friend constexpr bool operator>=(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
59 friend constexpr partial_ordering
operator<=>(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
60 friend constexpr partial_ordering
operator<=>(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
;
63 constexpr bool test_eq(partial_ordering
const &other
) const noexcept
{
64 return __value_
== other
.__value_
;
71 inline constexpr partial_ordering
partial_ordering::less(_OrdResult::__less
);
72 inline constexpr partial_ordering
partial_ordering::equivalent(_EqResult::__equiv
);
73 inline constexpr partial_ordering
partial_ordering::greater(_OrdResult::__greater
);
74 inline constexpr partial_ordering
partial_ordering::unordered(_NCmpResult ::__unordered
);
75 constexpr bool operator==(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
76 return __v
.__is_ordered() && __v
.__value_
== 0;
78 constexpr bool operator<(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
79 return __v
.__is_ordered() && __v
.__value_
< 0;
81 constexpr bool operator<=(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
82 return __v
.__is_ordered() && __v
.__value_
<= 0;
84 constexpr bool operator>(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
85 return __v
.__is_ordered() && __v
.__value_
> 0;
87 constexpr bool operator>=(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
88 return __v
.__is_ordered() && __v
.__value_
>= 0;
90 constexpr bool operator==(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
91 return __v
.__is_ordered() && 0 == __v
.__value_
;
93 constexpr bool operator<(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
94 return __v
.__is_ordered() && 0 < __v
.__value_
;
96 constexpr bool operator<=(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
97 return __v
.__is_ordered() && 0 <= __v
.__value_
;
99 constexpr bool operator>(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
100 return __v
.__is_ordered() && 0 > __v
.__value_
;
102 constexpr bool operator>=(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
103 return __v
.__is_ordered() && 0 >= __v
.__value_
;
105 constexpr bool operator!=(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
106 return !__v
.__is_ordered() || __v
.__value_
!= 0;
108 constexpr bool operator!=(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
109 return !__v
.__is_ordered() || __v
.__value_
!= 0;
112 constexpr partial_ordering
operator<=>(partial_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
115 constexpr partial_ordering
operator<=>(_CmpUnspecifiedParam
, partial_ordering __v
) noexcept
{
116 return __v
< 0 ? partial_ordering::greater
: (__v
> 0 ? partial_ordering::less
: __v
);
119 class weak_ordering
{
120 using _ValueT
= signed char;
121 explicit constexpr weak_ordering(_EqResult __v
) noexcept
: __value_(_ValueT(__v
)) {}
122 explicit constexpr weak_ordering(_OrdResult __v
) noexcept
: __value_(_ValueT(__v
)) {}
125 static const weak_ordering less
;
126 static const weak_ordering equivalent
;
127 static const weak_ordering greater
;
130 constexpr operator partial_ordering() const noexcept
{
131 return __value_
== 0 ? partial_ordering::equivalent
132 : (__value_
< 0 ? partial_ordering::less
: partial_ordering::greater
);
136 friend constexpr bool operator==(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
137 friend constexpr bool operator!=(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
138 friend constexpr bool operator<(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
139 friend constexpr bool operator<=(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
140 friend constexpr bool operator>(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
141 friend constexpr bool operator>=(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
142 friend constexpr bool operator==(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
143 friend constexpr bool operator!=(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
144 friend constexpr bool operator<(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
145 friend constexpr bool operator<=(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
146 friend constexpr bool operator>(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
147 friend constexpr bool operator>=(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
149 friend constexpr weak_ordering
operator<=>(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
150 friend constexpr weak_ordering
operator<=>(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
;
153 constexpr bool test_eq(weak_ordering
const &other
) const noexcept
{
154 return __value_
== other
.__value_
;
161 inline constexpr weak_ordering
weak_ordering::less(_OrdResult::__less
);
162 inline constexpr weak_ordering
weak_ordering::equivalent(_EqResult::__equiv
);
163 inline constexpr weak_ordering
weak_ordering::greater(_OrdResult::__greater
);
164 constexpr bool operator==(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
165 return __v
.__value_
== 0;
167 constexpr bool operator!=(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
168 return __v
.__value_
!= 0;
170 constexpr bool operator<(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
171 return __v
.__value_
< 0;
173 constexpr bool operator<=(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
174 return __v
.__value_
<= 0;
176 constexpr bool operator>(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
177 return __v
.__value_
> 0;
179 constexpr bool operator>=(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
180 return __v
.__value_
>= 0;
182 constexpr bool operator==(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
183 return 0 == __v
.__value_
;
185 constexpr bool operator!=(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
186 return 0 != __v
.__value_
;
188 constexpr bool operator<(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
189 return 0 < __v
.__value_
;
191 constexpr bool operator<=(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
192 return 0 <= __v
.__value_
;
194 constexpr bool operator>(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
195 return 0 > __v
.__value_
;
197 constexpr bool operator>=(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
198 return 0 >= __v
.__value_
;
201 constexpr weak_ordering
operator<=>(weak_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
204 constexpr weak_ordering
operator<=>(_CmpUnspecifiedParam
, weak_ordering __v
) noexcept
{
205 return __v
< 0 ? weak_ordering::greater
: (__v
> 0 ? weak_ordering::less
: __v
);
208 class strong_ordering
{
209 using _ValueT
= signed char;
210 explicit constexpr strong_ordering(_EqResult __v
) noexcept
: __value_(static_cast<signed char>(__v
)) {}
211 explicit constexpr strong_ordering(_OrdResult __v
) noexcept
: __value_(static_cast<signed char>(__v
)) {}
214 static const strong_ordering less
;
215 static const strong_ordering equal
;
216 static const strong_ordering equivalent
;
217 static const strong_ordering greater
;
220 constexpr operator partial_ordering() const noexcept
{
221 return __value_
== 0 ? partial_ordering::equivalent
222 : (__value_
< 0 ? partial_ordering::less
: partial_ordering::greater
);
224 constexpr operator weak_ordering() const noexcept
{
225 return __value_
== 0 ? weak_ordering::equivalent
226 : (__value_
< 0 ? weak_ordering::less
: weak_ordering::greater
);
230 friend constexpr bool operator==(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
231 friend constexpr bool operator!=(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
232 friend constexpr bool operator<(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
233 friend constexpr bool operator<=(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
234 friend constexpr bool operator>(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
235 friend constexpr bool operator>=(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
236 friend constexpr bool operator==(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
237 friend constexpr bool operator!=(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
238 friend constexpr bool operator<(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
239 friend constexpr bool operator<=(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
240 friend constexpr bool operator>(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
241 friend constexpr bool operator>=(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
243 friend constexpr strong_ordering
operator<=>(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
;
244 friend constexpr strong_ordering
operator<=>(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
;
247 constexpr bool test_eq(strong_ordering
const &other
) const noexcept
{
248 return __value_
== other
.__value_
;
255 inline constexpr strong_ordering
strong_ordering::less(_OrdResult::__less
);
256 inline constexpr strong_ordering
strong_ordering::equal(_EqResult::__equal
);
257 inline constexpr strong_ordering
strong_ordering::equivalent(_EqResult::__equiv
);
258 inline constexpr strong_ordering
strong_ordering::greater(_OrdResult::__greater
);
260 constexpr bool operator==(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
261 return __v
.__value_
== 0;
263 constexpr bool operator!=(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
264 return __v
.__value_
!= 0;
266 constexpr bool operator<(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
267 return __v
.__value_
< 0;
269 constexpr bool operator<=(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
270 return __v
.__value_
<= 0;
272 constexpr bool operator>(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
273 return __v
.__value_
> 0;
275 constexpr bool operator>=(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
276 return __v
.__value_
>= 0;
278 constexpr bool operator==(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
279 return 0 == __v
.__value_
;
281 constexpr bool operator!=(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
282 return 0 != __v
.__value_
;
284 constexpr bool operator<(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
285 return 0 < __v
.__value_
;
287 constexpr bool operator<=(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
288 return 0 <= __v
.__value_
;
290 constexpr bool operator>(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
291 return 0 > __v
.__value_
;
293 constexpr bool operator>=(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
294 return 0 >= __v
.__value_
;
297 constexpr strong_ordering
operator<=>(strong_ordering __v
, _CmpUnspecifiedParam
) noexcept
{
300 constexpr strong_ordering
operator<=>(_CmpUnspecifiedParam
, strong_ordering __v
) noexcept
{
301 return __v
< 0 ? strong_ordering::greater
: (__v
> 0 ? strong_ordering::less
: __v
);
305 } // end namespace std
307 #endif // STD_COMPARE_H