From 5d681f9efe25e3841ba42a166a77830893c24b8e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 26 Jul 2013 00:49:04 +0200 Subject: [PATCH] StronglyTypedNumber: take parameters by value --- src/units.hh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/units.hh b/src/units.hh index 652b66ab..8f9172ca 100644 --- a/src/units.hh +++ b/src/units.hh @@ -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(*this); } - RealType& operator-=(const RealType& other) + RealType& operator-=(RealType other) { m_value -= other.m_value; return static_cast(*this); } - RealType& operator*=(const RealType& other) + RealType& operator*=(RealType other) { m_value *= other.m_value; return static_cast(*this); } - RealType& operator/=(const RealType& other) + RealType& operator/=(RealType other) { m_value /= other.m_value; return static_cast(*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