xref: /llvm-project/clang/test/CodeGenCXX/Inputs/std-compare.h (revision f495de43bd5da50286da6020e508d106cfc60f57)
10683c0e6SEric Fiselier #ifndef STD_COMPARE_H
20683c0e6SEric Fiselier #define STD_COMPARE_H
30683c0e6SEric Fiselier 
40683c0e6SEric Fiselier namespace std {
50683c0e6SEric Fiselier inline namespace __1 {
60683c0e6SEric Fiselier 
70683c0e6SEric Fiselier // exposition only
80683c0e6SEric Fiselier enum class _EqResult : unsigned char {
9*f495de43SRichard Smith   __equal = 0,
100683c0e6SEric Fiselier   __equiv = __equal,
110683c0e6SEric Fiselier };
120683c0e6SEric Fiselier 
130683c0e6SEric Fiselier enum class _OrdResult : signed char {
140683c0e6SEric Fiselier   __less = -1,
150683c0e6SEric Fiselier   __greater = 1
160683c0e6SEric Fiselier };
170683c0e6SEric Fiselier 
180683c0e6SEric Fiselier enum class _NCmpResult : signed char {
190683c0e6SEric Fiselier   __unordered = -127
200683c0e6SEric Fiselier };
210683c0e6SEric Fiselier 
220683c0e6SEric Fiselier struct _CmpUnspecifiedType;
230683c0e6SEric Fiselier using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)();
240683c0e6SEric Fiselier 
250683c0e6SEric Fiselier class partial_ordering {
260683c0e6SEric Fiselier   using _ValueT = signed char;
partial_ordering(_EqResult __v)270683c0e6SEric Fiselier   explicit constexpr partial_ordering(_EqResult __v) noexcept
280683c0e6SEric Fiselier       : __value_(_ValueT(__v)) {}
partial_ordering(_OrdResult __v)290683c0e6SEric Fiselier   explicit constexpr partial_ordering(_OrdResult __v) noexcept
300683c0e6SEric Fiselier       : __value_(_ValueT(__v)) {}
partial_ordering(_NCmpResult __v)310683c0e6SEric Fiselier   explicit constexpr partial_ordering(_NCmpResult __v) noexcept
320683c0e6SEric Fiselier       : __value_(_ValueT(__v)) {}
330683c0e6SEric Fiselier 
__is_ordered()340683c0e6SEric Fiselier   constexpr bool __is_ordered() const noexcept {
350683c0e6SEric Fiselier     return __value_ != _ValueT(_NCmpResult::__unordered);
360683c0e6SEric Fiselier   }
370683c0e6SEric Fiselier 
380683c0e6SEric Fiselier public:
390683c0e6SEric Fiselier   // valid values
400683c0e6SEric Fiselier   static const partial_ordering less;
410683c0e6SEric Fiselier   static const partial_ordering equivalent;
420683c0e6SEric Fiselier   static const partial_ordering greater;
430683c0e6SEric Fiselier   static const partial_ordering unordered;
440683c0e6SEric Fiselier 
450683c0e6SEric Fiselier   // comparisons
460683c0e6SEric Fiselier   friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
470683c0e6SEric Fiselier   friend constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
480683c0e6SEric Fiselier   friend constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
490683c0e6SEric Fiselier   friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
500683c0e6SEric Fiselier   friend constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
510683c0e6SEric Fiselier   friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
520683c0e6SEric Fiselier   friend constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
530683c0e6SEric Fiselier   friend constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
540683c0e6SEric Fiselier   friend constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
550683c0e6SEric Fiselier   friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
560683c0e6SEric Fiselier   friend constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
570683c0e6SEric Fiselier   friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
580683c0e6SEric Fiselier 
590683c0e6SEric Fiselier   friend constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
600683c0e6SEric Fiselier   friend constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
610683c0e6SEric Fiselier 
620683c0e6SEric Fiselier   // test helper
test_eq(partial_ordering const & other)630683c0e6SEric Fiselier   constexpr bool test_eq(partial_ordering const &other) const noexcept {
640683c0e6SEric Fiselier     return __value_ == other.__value_;
650683c0e6SEric Fiselier   }
660683c0e6SEric Fiselier 
670683c0e6SEric Fiselier private:
680683c0e6SEric Fiselier   _ValueT __value_;
690683c0e6SEric Fiselier };
700683c0e6SEric Fiselier 
710683c0e6SEric Fiselier inline constexpr partial_ordering partial_ordering::less(_OrdResult::__less);
720683c0e6SEric Fiselier inline constexpr partial_ordering partial_ordering::equivalent(_EqResult::__equiv);
730683c0e6SEric Fiselier inline constexpr partial_ordering partial_ordering::greater(_OrdResult::__greater);
740683c0e6SEric Fiselier inline constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__unordered);
750683c0e6SEric Fiselier constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
760683c0e6SEric Fiselier   return __v.__is_ordered() && __v.__value_ == 0;
770683c0e6SEric Fiselier }
780683c0e6SEric Fiselier constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
790683c0e6SEric Fiselier   return __v.__is_ordered() && __v.__value_ < 0;
800683c0e6SEric Fiselier }
810683c0e6SEric Fiselier constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
820683c0e6SEric Fiselier   return __v.__is_ordered() && __v.__value_ <= 0;
830683c0e6SEric Fiselier }
840683c0e6SEric Fiselier constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
850683c0e6SEric Fiselier   return __v.__is_ordered() && __v.__value_ > 0;
860683c0e6SEric Fiselier }
870683c0e6SEric Fiselier constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
880683c0e6SEric Fiselier   return __v.__is_ordered() && __v.__value_ >= 0;
890683c0e6SEric Fiselier }
900683c0e6SEric Fiselier constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
910683c0e6SEric Fiselier   return __v.__is_ordered() && 0 == __v.__value_;
920683c0e6SEric Fiselier }
930683c0e6SEric Fiselier constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
940683c0e6SEric Fiselier   return __v.__is_ordered() && 0 < __v.__value_;
950683c0e6SEric Fiselier }
960683c0e6SEric Fiselier constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
970683c0e6SEric Fiselier   return __v.__is_ordered() && 0 <= __v.__value_;
980683c0e6SEric Fiselier }
990683c0e6SEric Fiselier constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
1000683c0e6SEric Fiselier   return __v.__is_ordered() && 0 > __v.__value_;
1010683c0e6SEric Fiselier }
1020683c0e6SEric Fiselier constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
1030683c0e6SEric Fiselier   return __v.__is_ordered() && 0 >= __v.__value_;
1040683c0e6SEric Fiselier }
1050683c0e6SEric Fiselier constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
1060683c0e6SEric Fiselier   return !__v.__is_ordered() || __v.__value_ != 0;
1070683c0e6SEric Fiselier }
1080683c0e6SEric Fiselier constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
1090683c0e6SEric Fiselier   return !__v.__is_ordered() || __v.__value_ != 0;
1100683c0e6SEric Fiselier }
1110683c0e6SEric Fiselier 
1120683c0e6SEric Fiselier constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
1130683c0e6SEric Fiselier   return __v;
1140683c0e6SEric Fiselier }
1150683c0e6SEric Fiselier constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
1160683c0e6SEric Fiselier   return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v);
1170683c0e6SEric Fiselier }
1180683c0e6SEric Fiselier 
1190683c0e6SEric Fiselier class weak_ordering {
1200683c0e6SEric Fiselier   using _ValueT = signed char;
weak_ordering(_EqResult __v)1210683c0e6SEric Fiselier   explicit constexpr weak_ordering(_EqResult __v) noexcept : __value_(_ValueT(__v)) {}
weak_ordering(_OrdResult __v)1220683c0e6SEric Fiselier   explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
1230683c0e6SEric Fiselier 
1240683c0e6SEric Fiselier public:
1250683c0e6SEric Fiselier   static const weak_ordering less;
1260683c0e6SEric Fiselier   static const weak_ordering equivalent;
1270683c0e6SEric Fiselier   static const weak_ordering greater;
1280683c0e6SEric Fiselier 
1290683c0e6SEric Fiselier   // conversions
partial_ordering()1300683c0e6SEric Fiselier   constexpr operator partial_ordering() const noexcept {
1310683c0e6SEric Fiselier     return __value_ == 0 ? partial_ordering::equivalent
1320683c0e6SEric Fiselier                          : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
1330683c0e6SEric Fiselier   }
1340683c0e6SEric Fiselier 
1350683c0e6SEric Fiselier   // comparisons
1360683c0e6SEric Fiselier   friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1370683c0e6SEric Fiselier   friend constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1380683c0e6SEric Fiselier   friend constexpr bool operator<(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1390683c0e6SEric Fiselier   friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1400683c0e6SEric Fiselier   friend constexpr bool operator>(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1410683c0e6SEric Fiselier   friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1420683c0e6SEric Fiselier   friend constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1430683c0e6SEric Fiselier   friend constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1440683c0e6SEric Fiselier   friend constexpr bool operator<(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1450683c0e6SEric Fiselier   friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1460683c0e6SEric Fiselier   friend constexpr bool operator>(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1470683c0e6SEric Fiselier   friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1480683c0e6SEric Fiselier 
1490683c0e6SEric Fiselier   friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
1500683c0e6SEric Fiselier   friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
1510683c0e6SEric Fiselier 
1520683c0e6SEric Fiselier   // test helper
test_eq(weak_ordering const & other)1530683c0e6SEric Fiselier   constexpr bool test_eq(weak_ordering const &other) const noexcept {
1540683c0e6SEric Fiselier     return __value_ == other.__value_;
1550683c0e6SEric Fiselier   }
1560683c0e6SEric Fiselier 
1570683c0e6SEric Fiselier private:
1580683c0e6SEric Fiselier   _ValueT __value_;
1590683c0e6SEric Fiselier };
1600683c0e6SEric Fiselier 
1610683c0e6SEric Fiselier inline constexpr weak_ordering weak_ordering::less(_OrdResult::__less);
1620683c0e6SEric Fiselier inline constexpr weak_ordering weak_ordering::equivalent(_EqResult::__equiv);
1630683c0e6SEric Fiselier inline constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater);
1640683c0e6SEric Fiselier constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
1650683c0e6SEric Fiselier   return __v.__value_ == 0;
1660683c0e6SEric Fiselier }
1670683c0e6SEric Fiselier constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
1680683c0e6SEric Fiselier   return __v.__value_ != 0;
1690683c0e6SEric Fiselier }
1700683c0e6SEric Fiselier constexpr bool operator<(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
1710683c0e6SEric Fiselier   return __v.__value_ < 0;
1720683c0e6SEric Fiselier }
1730683c0e6SEric Fiselier constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
1740683c0e6SEric Fiselier   return __v.__value_ <= 0;
1750683c0e6SEric Fiselier }
1760683c0e6SEric Fiselier constexpr bool operator>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
1770683c0e6SEric Fiselier   return __v.__value_ > 0;
1780683c0e6SEric Fiselier }
1790683c0e6SEric Fiselier constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
1800683c0e6SEric Fiselier   return __v.__value_ >= 0;
1810683c0e6SEric Fiselier }
1820683c0e6SEric Fiselier constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
1830683c0e6SEric Fiselier   return 0 == __v.__value_;
1840683c0e6SEric Fiselier }
1850683c0e6SEric Fiselier constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
1860683c0e6SEric Fiselier   return 0 != __v.__value_;
1870683c0e6SEric Fiselier }
1880683c0e6SEric Fiselier constexpr bool operator<(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
1890683c0e6SEric Fiselier   return 0 < __v.__value_;
1900683c0e6SEric Fiselier }
1910683c0e6SEric Fiselier constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
1920683c0e6SEric Fiselier   return 0 <= __v.__value_;
1930683c0e6SEric Fiselier }
1940683c0e6SEric Fiselier constexpr bool operator>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
1950683c0e6SEric Fiselier   return 0 > __v.__value_;
1960683c0e6SEric Fiselier }
1970683c0e6SEric Fiselier constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
1980683c0e6SEric Fiselier   return 0 >= __v.__value_;
1990683c0e6SEric Fiselier }
2000683c0e6SEric Fiselier 
2010683c0e6SEric Fiselier constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
2020683c0e6SEric Fiselier   return __v;
2030683c0e6SEric Fiselier }
2040683c0e6SEric Fiselier constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
2050683c0e6SEric Fiselier   return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v);
2060683c0e6SEric Fiselier }
2070683c0e6SEric Fiselier 
2080683c0e6SEric Fiselier class strong_ordering {
2090683c0e6SEric Fiselier   using _ValueT = signed char;
strong_ordering(_EqResult __v)2100683c0e6SEric Fiselier   explicit constexpr strong_ordering(_EqResult __v) noexcept : __value_(static_cast<signed char>(__v)) {}
strong_ordering(_OrdResult __v)2110683c0e6SEric Fiselier   explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(static_cast<signed char>(__v)) {}
2120683c0e6SEric Fiselier 
2130683c0e6SEric Fiselier public:
2140683c0e6SEric Fiselier   static const strong_ordering less;
2150683c0e6SEric Fiselier   static const strong_ordering equal;
2160683c0e6SEric Fiselier   static const strong_ordering equivalent;
2170683c0e6SEric Fiselier   static const strong_ordering greater;
2180683c0e6SEric Fiselier 
2190683c0e6SEric Fiselier   // conversions
partial_ordering()2200683c0e6SEric Fiselier   constexpr operator partial_ordering() const noexcept {
2210683c0e6SEric Fiselier     return __value_ == 0 ? partial_ordering::equivalent
2220683c0e6SEric Fiselier                          : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
2230683c0e6SEric Fiselier   }
weak_ordering()2240683c0e6SEric Fiselier   constexpr operator weak_ordering() const noexcept {
2250683c0e6SEric Fiselier     return __value_ == 0 ? weak_ordering::equivalent
2260683c0e6SEric Fiselier                          : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
2270683c0e6SEric Fiselier   }
2280683c0e6SEric Fiselier 
2290683c0e6SEric Fiselier   // comparisons
2300683c0e6SEric Fiselier   friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2310683c0e6SEric Fiselier   friend constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2320683c0e6SEric Fiselier   friend constexpr bool operator<(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2330683c0e6SEric Fiselier   friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2340683c0e6SEric Fiselier   friend constexpr bool operator>(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2350683c0e6SEric Fiselier   friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2360683c0e6SEric Fiselier   friend constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2370683c0e6SEric Fiselier   friend constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2380683c0e6SEric Fiselier   friend constexpr bool operator<(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2390683c0e6SEric Fiselier   friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2400683c0e6SEric Fiselier   friend constexpr bool operator>(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2410683c0e6SEric Fiselier   friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2420683c0e6SEric Fiselier 
2430683c0e6SEric Fiselier   friend constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
2440683c0e6SEric Fiselier   friend constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
2450683c0e6SEric Fiselier 
2460683c0e6SEric Fiselier   // test helper
test_eq(strong_ordering const & other)2470683c0e6SEric Fiselier   constexpr bool test_eq(strong_ordering const &other) const noexcept {
2480683c0e6SEric Fiselier     return __value_ == other.__value_;
2490683c0e6SEric Fiselier   }
2500683c0e6SEric Fiselier 
2510683c0e6SEric Fiselier private:
2520683c0e6SEric Fiselier   _ValueT __value_;
2530683c0e6SEric Fiselier };
2540683c0e6SEric Fiselier 
2550683c0e6SEric Fiselier inline constexpr strong_ordering strong_ordering::less(_OrdResult::__less);
2560683c0e6SEric Fiselier inline constexpr strong_ordering strong_ordering::equal(_EqResult::__equal);
2570683c0e6SEric Fiselier inline constexpr strong_ordering strong_ordering::equivalent(_EqResult::__equiv);
2580683c0e6SEric Fiselier inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater);
2590683c0e6SEric Fiselier 
2600683c0e6SEric Fiselier constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2610683c0e6SEric Fiselier   return __v.__value_ == 0;
2620683c0e6SEric Fiselier }
2630683c0e6SEric Fiselier constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2640683c0e6SEric Fiselier   return __v.__value_ != 0;
2650683c0e6SEric Fiselier }
2660683c0e6SEric Fiselier constexpr bool operator<(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2670683c0e6SEric Fiselier   return __v.__value_ < 0;
2680683c0e6SEric Fiselier }
2690683c0e6SEric Fiselier constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2700683c0e6SEric Fiselier   return __v.__value_ <= 0;
2710683c0e6SEric Fiselier }
2720683c0e6SEric Fiselier constexpr bool operator>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2730683c0e6SEric Fiselier   return __v.__value_ > 0;
2740683c0e6SEric Fiselier }
2750683c0e6SEric Fiselier constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2760683c0e6SEric Fiselier   return __v.__value_ >= 0;
2770683c0e6SEric Fiselier }
2780683c0e6SEric Fiselier constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
2790683c0e6SEric Fiselier   return 0 == __v.__value_;
2800683c0e6SEric Fiselier }
2810683c0e6SEric Fiselier constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
2820683c0e6SEric Fiselier   return 0 != __v.__value_;
2830683c0e6SEric Fiselier }
2840683c0e6SEric Fiselier constexpr bool operator<(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
2850683c0e6SEric Fiselier   return 0 < __v.__value_;
2860683c0e6SEric Fiselier }
2870683c0e6SEric Fiselier constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
2880683c0e6SEric Fiselier   return 0 <= __v.__value_;
2890683c0e6SEric Fiselier }
2900683c0e6SEric Fiselier constexpr bool operator>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
2910683c0e6SEric Fiselier   return 0 > __v.__value_;
2920683c0e6SEric Fiselier }
2930683c0e6SEric Fiselier constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
2940683c0e6SEric Fiselier   return 0 >= __v.__value_;
2950683c0e6SEric Fiselier }
2960683c0e6SEric Fiselier 
2970683c0e6SEric Fiselier constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
2980683c0e6SEric Fiselier   return __v;
2990683c0e6SEric Fiselier }
3000683c0e6SEric Fiselier constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
3010683c0e6SEric Fiselier   return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v);
3020683c0e6SEric Fiselier }
3030683c0e6SEric Fiselier 
3040683c0e6SEric Fiselier } // namespace __1
3050683c0e6SEric Fiselier } // end namespace std
3060683c0e6SEric Fiselier 
3070683c0e6SEric Fiselier #endif // STD_COMPARE_H
308