diff options
author | John Wiegley <johnw@newartisans.com> | 2006-03-04 14:46:04 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 05:48:44 -0400 |
commit | 581b3d5b9a3eebdd8f396d910386cadd9426b915 (patch) | |
tree | c7493496010c811cf276a1e68d7c10bc87e7abbd /balance.h | |
parent | 6375730fc9af02c27ec774aa2b9929095f5ffbde (diff) | |
download | fork-ledger-581b3d5b9a3eebdd8f396d910386cadd9426b915.tar.gz fork-ledger-581b3d5b9a3eebdd8f396d910386cadd9426b915.tar.bz2 fork-ledger-581b3d5b9a3eebdd8f396d910386cadd9426b915.zip |
*** no comment ***
Diffstat (limited to 'balance.h')
-rw-r--r-- | balance.h | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -97,14 +97,10 @@ class balance_t } balance_t& operator-=(const amount_t& amt) { amounts_map::iterator i = amounts.find(&amt.commodity()); - if (i != amounts.end()) { + if (i != amounts.end()) (*i).second -= amt; - if (! (*i).second) - amounts.erase(&amt.commodity()); - } - else if (amt) { + else amounts.insert(amounts_pair(&amt.commodity(), - amt)); - } return *this; } template <typename T> @@ -151,10 +147,7 @@ class balance_t balance_t& operator*=(const amount_t& amt) { // Multiplying by the null commodity causes all amounts to be // increased by the same factor. - if (! amt) { - amounts.clear(); - } - else if (! amt.commodity()) { + if (! amt.commodity()) { for (amounts_map::iterator i = amounts.begin(); i != amounts.end(); i++) |