diff options
author | John Wiegley <johnw@newartisans.com> | 2006-03-19 23:16:31 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 05:48:45 -0400 |
commit | f60717d3f4bd3f3c04e08edbe459495d00936d0c (patch) | |
tree | b573b4e23dbcec06d7f4b79835127a2d64db5db7 /amount.h | |
parent | 7adb262823377bc40085ba5b66a6448a3d58db0b (diff) | |
download | fork-ledger-f60717d3f4bd3f3c04e08edbe459495d00936d0c.tar.gz fork-ledger-f60717d3f4bd3f3c04e08edbe459495d00936d0c.tar.bz2 fork-ledger-f60717d3f4bd3f3c04e08edbe459495d00936d0c.zip |
*** no comment ***
Diffstat (limited to 'amount.h')
-rw-r--r-- | amount.h | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -181,16 +181,22 @@ class amount_t operator double() const; // comparisons between amounts - bool operator<(const amount_t& amt) const; - bool operator<=(const amount_t& amt) const; - bool operator>(const amount_t& amt) const; - bool operator>=(const amount_t& amt) const; - bool operator==(const amount_t& amt) const; - bool operator!=(const amount_t& amt) const { - if (commodity_ != amt.commodity_) - return true; - return ! (*this == amt); + int compare(const amount_t& amt) const; + + bool operator<(const amount_t& amt) const { + return compare(amt) < 0; + } + bool operator<=(const amount_t& amt) const { + return compare(amt) <= 0; } + bool operator>(const amount_t& amt) const { + return compare(amt) > 0; + } + bool operator>=(const amount_t& amt) const { + return compare(amt) >= 0; + } + bool operator==(const amount_t& amt) const; + bool operator!=(const amount_t& amt) const; template <typename T> void parse_num(T num) { |