|
|
@@ -8,9 +8,23 @@ namespace types {
|
|
|
friend bool operator!=(Self const & lhs, Self const & rhs) {
|
|
|
return !(lhs == rhs);
|
|
|
}
|
|
|
+
|
|
|
+#if __cplusplus >= 202002L
|
|
|
+ friend std::partial_ordering operator<=>(Self const & lhs,
|
|
|
+ Self const & rhs) {
|
|
|
+ return lhs == rhs ? std::partial_ordering::equivalent
|
|
|
+ : std::partial_ordering::unordered;
|
|
|
+ }
|
|
|
+#endif
|
|
|
};
|
|
|
|
|
|
- template <typename Self> struct Comparable : EqualityComparable<Self> {
|
|
|
+ template <typename Self> struct Comparable {
|
|
|
+ friend bool operator==(Self const & lhs, Self const & rhs) {
|
|
|
+ return lhs.get() == rhs.get();
|
|
|
+ }
|
|
|
+ friend bool operator!=(Self const & lhs, Self const & rhs) {
|
|
|
+ return !(lhs == rhs);
|
|
|
+ }
|
|
|
friend bool operator<(Self const & lhs, Self const & rhs) {
|
|
|
return lhs.get() < rhs.get();
|
|
|
}
|
|
|
@@ -23,5 +37,11 @@ namespace types {
|
|
|
friend bool operator>=(Self const & lhs, Self const & rhs) {
|
|
|
return !(lhs.get() < rhs.get());
|
|
|
}
|
|
|
+
|
|
|
+#if __cplusplus >= 202002L
|
|
|
+ friend auto operator<=>(Self const & lhs, Self const & rhs) {
|
|
|
+ return lhs.get() <=> rhs.get();
|
|
|
+ }
|
|
|
+#endif
|
|
|
};
|
|
|
}
|