memgraph/utils/total_ordering.hpp
2015-12-14 20:29:02 +01:00

26 lines
516 B
C++

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