summaryrefslogtreecommitdiff
path: root/balance.cc
diff options
context:
space:
mode:
Diffstat (limited to 'balance.cc')
-rw-r--r--balance.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/balance.cc b/balance.cc
index 604d9d82..8ca49ea0 100644
--- a/balance.cc
+++ b/balance.cc
@@ -94,8 +94,7 @@ balance_t& balance_t::operator*=(const balance_t& bal)
return *this *= (*bal.amounts.begin()).second;
}
else {
- std::string msg;
- std::ostringstream errmsg(msg);
+ std::ostringstream errmsg;
errmsg << "It makes no sense to multiply two balances: "
<< *this << " * " << bal;
throw amount_error(errmsg.str());
@@ -108,8 +107,7 @@ balance_t& balance_t::operator/=(const balance_t& bal)
return (*this = 0L);
}
else if (! bal) {
- std::string msg;
- std::ostringstream errmsg(msg);
+ std::ostringstream errmsg;
errmsg << "Attempt to divide by zero: " << *this << " / " << bal;
throw amount_error(errmsg.str());
}
@@ -120,8 +118,7 @@ balance_t& balance_t::operator/=(const balance_t& bal)
return (*this = 1L);
}
else {
- std::string msg;
- std::ostringstream errmsg(msg);
+ std::ostringstream errmsg;
errmsg << "It makes no sense to divide two balances: "
<< *this << " / " << bal;
throw amount_error(errmsg.str());
@@ -137,8 +134,7 @@ balance_t::operator amount_t() const
return amount_t();
}
else {
- std::string msg;
- std::ostringstream errmsg(msg);
+ std::ostringstream errmsg;
errmsg << "Cannot convert a balance with "
<< "multiple commodities to an amount: " << *this;
throw amount_error(errmsg.str());