| 1234567891011121314151617181920212223242526272829 |
- #pragma once
- namespace types {
- template <typename Self>
- struct EqualityComparable {
- 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);
- }
- };
-
- template <typename Self>
- struct Comparable : EqualityComparable<Self> {
- friend bool operator<(Self const & lhs, Self const & rhs) {
- return lhs.get() < rhs.get();
- }
- friend bool operator>(Self const & lhs, Self const & rhs) {
- return rhs.get() < lhs.get();
- }
- friend bool operator<=(Self const & lhs, Self const & rhs) {
- return !(rhs.get() < lhs.get());
- }
- friend bool operator>=(Self const & lhs, Self const & rhs) {
- return !(lhs.get() < rhs.get());
- }
- };
- }
|