diff options
Diffstat (limited to 'balance.cc')
-rw-r--r-- | balance.cc | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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()); |