Use a special pair with the inner objects const when looking up order books.

See: http://ideone.com/QggSh9
This commit is contained in:
JoelKatz
2013-03-16 04:59:52 -07:00
parent e477bcd6a9
commit efcc7b885c
2 changed files with 5 additions and 4 deletions

View File

@@ -53,8 +53,8 @@ void OrderBookDB::setup(Ledger::ref ledger)
OrderBook::pointer book = boost::make_shared<OrderBook>(boost::cref(index),
boost::cref(ci), boost::cref(co), boost::cref(ii), boost::cref(io));
mSourceMap[currencyIssuer_t(ci, ii)].push_back(book);
mDestMap[currencyIssuer_t(co, io)].push_back(book);
mSourceMap[currencyIssuer_ct(ci, ii)].push_back(book);
mDestMap[currencyIssuer_ct(co, io)].push_back(book);
}
}
@@ -70,7 +70,7 @@ void OrderBookDB::getBooksByTakerPays(const uint160& issuerID, const uint160& cu
{
boost::recursive_mutex::scoped_lock sl(mLock);
boost::unordered_map< currencyIssuer_t, std::vector<OrderBook::pointer> >::const_iterator
it = mSourceMap.find(currencyIssuer_t(currencyID, issuerID));
it = mSourceMap.find(currencyIssuer_ct(currencyID, issuerID));
if (it != mSourceMap.end())
bookRet = it->second;
else
@@ -83,7 +83,7 @@ void OrderBookDB::getBooksByTakerGets(const uint160& issuerID, const uint160& cu
{
boost::recursive_mutex::scoped_lock sl(mLock);
boost::unordered_map< currencyIssuer_t, std::vector<OrderBook::pointer> >::const_iterator
it = mDestMap.find(currencyIssuer_t(currencyID, issuerID));
it = mDestMap.find(currencyIssuer_ct(currencyID, issuerID));
if (it != mDestMap.end())
bookRet = it->second;
else

View File

@@ -16,6 +16,7 @@
//
typedef std::pair<uint160, uint160> currencyIssuer_t;
typedef std::pair<const uint160&, const uint160&> currencyIssuer_ct;
class BookListeners
{