diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-27 02:15:27 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-27 02:15:27 -0400 |
commit | fbb0d2583173073e11976c7cd7e570d4829f0621 (patch) | |
tree | 7c83465d30bd45f89f82757d5f3041a9e3903f1f /src/balance.h | |
parent | ecb1ca71c12f7772d345f19b6df821da123d3b57 (diff) | |
download | fork-ledger-fbb0d2583173073e11976c7cd7e570d4829f0621.tar.gz fork-ledger-fbb0d2583173073e11976c7cd7e570d4829f0621.tar.bz2 fork-ledger-fbb0d2583173073e11976c7cd7e570d4829f0621.zip |
Gave round/unround/truncate all in_place_ variants
Diffstat (limited to 'src/balance.h')
-rw-r--r-- | src/balance.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/balance.h b/src/balance.h index f8e4f25c..71fc41be 100644 --- a/src/balance.h +++ b/src/balance.h @@ -312,24 +312,39 @@ public: } balance_t rounded() const { + balance_t temp(*this); + temp.in_place_round(); + return temp; + } + void in_place_round() { balance_t temp; foreach (const amounts_map::value_type& pair, amounts) temp += pair.second.rounded(); - return temp; + *this = temp; } balance_t truncated() const { + balance_t temp(*this); + temp.in_place_truncate(); + return temp; + } + void in_place_truncate() { balance_t temp; foreach (const amounts_map::value_type& pair, amounts) temp += pair.second.truncated(); - return temp; + *this = temp; } balance_t unrounded() const { + balance_t temp(*this); + temp.in_place_unround(); + return temp; + } + void in_place_unround() { balance_t temp; foreach (const amounts_map::value_type& pair, amounts) temp += pair.second.unrounded(); - return temp; + *this = temp; } balance_t reduced() const { |