[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/005 7f6a453 01/10: Revert "Partially revert
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/005 7f6a453 01/10: Revert "Partially revert the last commit" |
Date: |
Thu, 21 Jan 2021 17:48:14 -0500 (EST) |
branch: valyuta/005
commit 7f6a45357acbafcd4371e70834a440e2c50b0a80
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Revert "Partially revert the last commit"
This reverts commit b835c6d998be4dc78bdd076e00f4ec507730728f (code
only--not the 'Speed*' files, which are metadata). See:
https://lists.nongnu.org/archive/html/lmi/2021-01/msg00013.html
---
currency.hpp | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/currency.hpp b/currency.hpp
index 31c8128..45f6e2f 100644
--- a/currency.hpp
+++ b/currency.hpp
@@ -79,8 +79,8 @@ class LMI_SO currency
currency() = default;
explicit currency(data_type z, raw_cents) : m_ {z} {assert_integral(z);}
- currency& operator+=(currency const& z) {m_ += z.m_; return *this;}
- currency& operator-=(currency const& z) {m_ -= z.m_; return *this;}
+ currency& operator+=(currency z) {m_ += z.m_; return *this;}
+ currency& operator-=(currency z) {m_ -= z.m_; return *this;}
currency& operator*=(int z) {m_ *= z ; return *this;}
@@ -95,40 +95,40 @@ class LMI_SO currency
data_type m_ = {};
};
-inline bool operator==(currency const& lhs, currency const& rhs)
+inline bool operator==(currency lhs, currency rhs)
{return lhs.cents() == rhs.cents();}
-inline bool operator< (currency const& lhs, currency const& rhs)
+inline bool operator< (currency lhs, currency rhs)
{return lhs.cents() < rhs.cents();}
-inline bool operator!=(currency const& lhs, currency const& rhs)
+inline bool operator!=(currency lhs, currency rhs)
{return !operator==(lhs, rhs);}
-inline bool operator> (currency const& lhs, currency const& rhs)
+inline bool operator> (currency lhs, currency rhs)
{return operator< (rhs, lhs);}
-inline bool operator<=(currency const& lhs, currency const& rhs)
+inline bool operator<=(currency lhs, currency rhs)
{return !operator> (lhs, rhs);}
-inline bool operator>=(currency const& lhs, currency const& rhs)
+inline bool operator>=(currency lhs, currency rhs)
{return !operator< (lhs, rhs);}
-inline currency operator-(currency const& z)
+inline currency operator-(currency z)
{return currency(-z.cents(), raw_cents {});}
-inline currency operator+(currency const& lhs, currency const& rhs)
+inline currency operator+(currency lhs, currency rhs)
{return currency {lhs} += rhs;}
-inline currency operator-(currency const& lhs, currency const& rhs)
+inline currency operator-(currency lhs, currency rhs)
{return currency {lhs} -= rhs;}
-inline currency operator*(currency const& lhs, int rhs)
+inline currency operator*(currency lhs, int rhs)
{return currency {lhs} *= rhs;}
-inline currency operator*(int lhs, currency const& rhs)
+inline currency operator*(int lhs, currency rhs)
{return currency {rhs} *= lhs;}
-inline double operator*(currency const& lhs, double rhs)
+inline double operator*(currency lhs, double rhs)
{return lhs.d() * rhs;}
-inline double operator*(double lhs, currency const& rhs)
+inline double operator*(double lhs, currency rhs)
{return lhs * rhs.d();}
-inline double operator/(currency const& lhs, double rhs)
+inline double operator/(currency lhs, double rhs)
{return lhs.d() / rhs;}
-inline std::ostream& operator<<(std::ostream& os, currency const& z)
+inline std::ostream& operator<<(std::ostream& os, currency z)
{return os << z.d();}
inline currency from_cents(double z) {return currency(z, raw_cents{});}
- [lmi-commits] [lmi] valyuta/005 updated (133d646 -> 9e42155), Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 d763c34 04/10: Clean up, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 2712277 02/10: Default class currency's special member functions, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 86cba7f 09/10: Temporarily don't use currency class, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 7f6a453 01/10: Revert "Partially revert the last commit",
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/005 c0a93cf 03/10: Reorder currency unit tests, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 e40980b 05/10: Optionally detect nonintegral cents at run time, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 61396fd 06/10: Expunge the unclean macro just added, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 4b0bf87 07/10: Detect nonintegral cents along every path, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 6767160 08/10: Temporarily don't use cents, Greg Chicares, 2021/01/21
- [lmi-commits] [lmi] valyuta/005 9e42155 10/10: Undo temporary changes: use currency class with cents, Greg Chicares, 2021/01/21