| 123456789101112131415161718192021222324252627 |
- #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());
- }
- };
- }
|