From efcc7b885cdcdae6a8bae7ea676087b1256fb8fa Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 16 Mar 2013 04:59:52 -0700 Subject: [PATCH] Use a special pair with the inner objects const when looking up order books. See: http://ideone.com/QggSh9 --- src/cpp/ripple/OrderBookDB.cpp | 8 ++++---- src/cpp/ripple/OrderBookDB.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cpp/ripple/OrderBookDB.cpp b/src/cpp/ripple/OrderBookDB.cpp index 1d57aad0f6..4ebac57497 100644 --- a/src/cpp/ripple/OrderBookDB.cpp +++ b/src/cpp/ripple/OrderBookDB.cpp @@ -53,8 +53,8 @@ void OrderBookDB::setup(Ledger::ref ledger) OrderBook::pointer book = boost::make_shared(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 >::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 >::const_iterator - it = mDestMap.find(currencyIssuer_t(currencyID, issuerID)); + it = mDestMap.find(currencyIssuer_ct(currencyID, issuerID)); if (it != mDestMap.end()) bookRet = it->second; else diff --git a/src/cpp/ripple/OrderBookDB.h b/src/cpp/ripple/OrderBookDB.h index 5ad90ab1bc..e90f377685 100644 --- a/src/cpp/ripple/OrderBookDB.h +++ b/src/cpp/ripple/OrderBookDB.h @@ -16,6 +16,7 @@ // typedef std::pair currencyIssuer_t; +typedef std::pair currencyIssuer_ct; class BookListeners {