Round one of fixes to avoid ridiculous numbers of spurious copy constructor and destructor calls.

Most of these fixes involve calls to BOOST_FOREACH to iterate over a map or unordered_map where the
iterator type didn't perfectly match the internal type, so a reference into the map couldn't be created
and a new value/content pair had to be created for each iteration.
This commit is contained in:
JoelKatz
2012-12-17 20:20:24 -08:00
parent 961ac4690e
commit 2a06686b7c
14 changed files with 29 additions and 27 deletions

View File

@@ -20,8 +20,8 @@
#define LC_DEBUG
typedef std::pair<const uint160, LedgerProposal::pointer> u160_prop_pair;
typedef std::pair<const uint256, LCTransaction::pointer> u256_lct_pair;
typedef std::map<uint160, LedgerProposal::pointer>::value_type u160_prop_pair;
typedef std::map<uint256, LCTransaction::pointer>::value_type u256_lct_pair;
SETUP_LOG();
DECLARE_INSTANCE(LedgerConsensus);
@@ -348,7 +348,7 @@ void LedgerConsensus::checkLCL()
boost::unordered_map<uint256, currentValidationCount> vals =
theApp->getValidations().getCurrentValidations(favoredLedger);
typedef std::pair<const uint256, currentValidationCount> u256_cvc_pair;
typedef std::map<uint256, currentValidationCount>::value_type u256_cvc_pair;
BOOST_FOREACH(u256_cvc_pair& it, vals)
if (it.second.first > netLgrCount)
{
@@ -471,7 +471,7 @@ void LedgerConsensus::createDisputes(SHAMap::ref m1, SHAMap::ref m2)
SHAMap::SHAMapDiff differences;
m1->compare(m2, differences, 16384);
typedef std::pair<const uint256, SHAMap::SHAMapDiffItem> u256_diff_pair;
typedef std::map<uint256, SHAMap::SHAMapDiffItem>::value_type u256_diff_pair;
BOOST_FOREACH (u256_diff_pair& pos, differences)
{ // create disputed transactions (from the ledger that has them)
if (pos.second.first)