StronglyTypedNumber: take parameters by value

This commit is contained in:
Maxime Coste 2013-07-26 00:49:04 +02:00
parent d5453152b3
commit 5d681f9efe

View File

@ -17,28 +17,28 @@ public:
"RealType is not derived from StronglyTypedNumber");
}
constexpr RealType operator+(const RealType& other) const
constexpr RealType operator+(RealType other) const
{ return RealType(m_value + other.m_value); }
constexpr RealType operator-(const RealType& other) const
constexpr RealType operator-(RealType other) const
{ return RealType(m_value - other.m_value); }
constexpr RealType operator*(const RealType& other) const
constexpr RealType operator*(RealType other) const
{ return RealType(m_value * other.m_value); }
constexpr RealType operator/(const RealType& other) const
constexpr RealType operator/(RealType other) const
{ return RealType(m_value / other.m_value); }
RealType& operator+=(const RealType& other)
RealType& operator+=(RealType other)
{ m_value += other.m_value; return static_cast<RealType&>(*this); }
RealType& operator-=(const RealType& other)
RealType& operator-=(RealType other)
{ m_value -= other.m_value; return static_cast<RealType&>(*this); }
RealType& operator*=(const RealType& other)
RealType& operator*=(RealType other)
{ m_value *= other.m_value; return static_cast<RealType&>(*this); }
RealType& operator/=(const RealType& other)
RealType& operator/=(RealType other)
{ m_value /= other.m_value; return static_cast<RealType&>(*this); }
RealType& operator++()
@ -55,22 +55,22 @@ public:
constexpr RealType operator-() { return RealType(-m_value); }
constexpr bool operator==(const RealType& other) const
constexpr bool operator==(RealType other) const
{ return m_value == other.m_value; }
constexpr bool operator!=(const RealType& other) const
constexpr bool operator!=(RealType other) const
{ return m_value != other.m_value; }
constexpr bool operator<(const RealType& other) const
constexpr bool operator<(RealType other) const
{ return m_value < other.m_value; }
constexpr bool operator<=(const RealType& other) const
constexpr bool operator<=(RealType other) const
{ return m_value <= other.m_value; }
constexpr bool operator>(const RealType& other) const
constexpr bool operator>(RealType other) const
{ return m_value > other.m_value; }
constexpr bool operator>=(const RealType& other) const
constexpr bool operator>=(RealType other) const
{ return m_value >= other.m_value; }
constexpr bool operator!() const