2016-02-14 00:59:48 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
#include "storage/model/properties/utils/math_operations.hpp"
|
|
|
|
#include "storage/model/properties/utils/unary_negation.hpp"
|
2016-02-14 00:59:48 +08:00
|
|
|
#include "utils/total_ordering.hpp"
|
|
|
|
|
|
|
|
template <class Derived>
|
2016-09-05 17:02:48 +08:00
|
|
|
class Number : public TotalOrdering<Derived>,
|
2016-02-14 00:59:48 +08:00
|
|
|
public MathOperations<Derived>,
|
|
|
|
public UnaryNegation<Derived>
|
|
|
|
{
|
|
|
|
|
2016-09-05 17:02:48 +08:00
|
|
|
public:
|
|
|
|
std::ostream &print(std::ostream &stream) const
|
2016-02-14 00:59:48 +08:00
|
|
|
{
|
2016-09-05 17:02:48 +08:00
|
|
|
return operator<<(stream, this->derived());
|
2016-02-14 00:59:48 +08:00
|
|
|
}
|
|
|
|
|
2016-09-05 17:02:48 +08:00
|
|
|
friend std::ostream &operator<<(std::ostream &s, const Derived &number)
|
2016-02-14 00:59:48 +08:00
|
|
|
{
|
2016-09-05 17:02:48 +08:00
|
|
|
return s << number.value();
|
2016-02-14 00:59:48 +08:00
|
|
|
}
|
|
|
|
|
2016-09-05 17:02:48 +08:00
|
|
|
friend bool operator==(const Derived &lhs, const Derived &rhs)
|
2016-02-14 00:59:48 +08:00
|
|
|
{
|
2016-09-05 17:02:48 +08:00
|
|
|
return lhs.value() == rhs.value();
|
2016-02-14 00:59:48 +08:00
|
|
|
}
|
2016-02-21 00:53:09 +08:00
|
|
|
|
2016-09-05 17:02:48 +08:00
|
|
|
friend bool operator<(const Derived &lhs, const Derived &rhs)
|
2016-02-21 00:53:09 +08:00
|
|
|
{
|
2016-09-05 17:02:48 +08:00
|
|
|
return lhs.value() == rhs.value();
|
2016-02-21 00:53:09 +08:00
|
|
|
}
|
2016-02-14 00:59:48 +08:00
|
|
|
};
|