memgraph/include/utils/total_ordering_with.hpp
2016-08-10 09:39:02 +01:00

46 lines
933 B
C++

#pragma once
template <class Derived, class T>
struct TotalOrderingWith
{
friend constexpr bool operator!=(const Derived& a, const T& b)
{
return !(a == b);
}
friend constexpr bool operator<=(const Derived& a, const T& b)
{
return a < b || a == b;
}
friend constexpr bool operator>(const Derived& a, const T& b)
{
return !(a <= b);
}
friend constexpr bool operator>=(const Derived& a, const T& b)
{
return !(a < b);
}
friend constexpr bool operator!=(const T& a, const Derived& b)
{
return !(a == b);
}
friend constexpr bool operator<=(const T& a, const Derived& b)
{
return a < b || a == b;
}
friend constexpr bool operator>(const T& a, const Derived& b)
{
return !(a <= b);
}
friend constexpr bool operator>=(const T& a, const Derived& b)
{
return !(a < b);
}
};