diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-09 03:19:25 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-09 03:19:25 -0600 |
commit | 628875b33c4f1cd202091c9347ef0176f8b688fa (patch) | |
tree | a3de0dc0572a2cced0fb9eabc85b7591da03642c /src/commodity.cc | |
parent | b0cf90ab50ac42d3184d70cb1906778df034ddaa (diff) | |
download | fork-ledger-628875b33c4f1cd202091c9347ef0176f8b688fa.tar.gz fork-ledger-628875b33c4f1cd202091c9347ef0176f8b688fa.tar.bz2 fork-ledger-628875b33c4f1cd202091c9347ef0176f8b688fa.zip |
Use Boost.Tuple
Diffstat (limited to 'src/commodity.cc')
-rw-r--r-- | src/commodity.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/commodity.cc b/src/commodity.cc index dd1b2743..963fb646 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -129,16 +129,16 @@ commodity_t::find_price(const optional<commodity_t&>& commodity, if (target && *this == *target) return none; - optional<base_t::time_and_commodity_t> pair = - base_t::time_and_commodity_t(base_t::optional_time_pair_t(moment, oldest), - commodity ? &(*commodity) : NULL); + optional<base_t::memoized_price_entry> + entry(base_t::memoized_price_entry(moment, oldest, + commodity ? &(*commodity) : NULL)); DEBUG("commodity.price.find", "looking for memoized args: " << (moment ? format_datetime(*moment) : "NONE") << ", " << (oldest ? format_datetime(*oldest) : "NONE") << ", " << (commodity ? commodity->symbol() : "NONE")); { - base_t::memoized_price_map::iterator i = base->price_map.find(*pair); + base_t::memoized_price_map::iterator i = base->price_map.find(*entry); if (i != base->price_map.end()) { DEBUG("commodity.price.find", "found! returning: " << ((*i).second ? (*i).second->price : amount_t(0L))); @@ -162,7 +162,7 @@ commodity_t::find_price(const optional<commodity_t&>& commodity, pool().commodity_price_history.find_price(*this, *target, when, oldest) : pool().commodity_price_history.find_price(*this, when, oldest); - if (pair) { + if (entry) { if (base->price_map.size() > base_t::max_price_map_size) { DEBUG("history.find", "price map has grown too large, clearing it by half"); @@ -172,9 +172,9 @@ commodity_t::find_price(const optional<commodity_t&>& commodity, DEBUG("history.find", "remembered: " << (point ? point->price : amount_t(0L))); - base->price_map.insert - (base_t::memoized_price_map::value_type(*pair, point)); + base->price_map.insert(base_t::memoized_price_map::value_type(*entry, point)); } + return point; } |