mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Use range-based for loops (C++11) when looping over map elements
Before this commit:
for (std::map<T1, T2>::iterator x = y.begin(); x != y.end(); ++x) {
}
After this commit:
for (auto& x : y) {
}
This commit is contained in:
@@ -1398,14 +1398,14 @@ UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool fByA
|
||||
|
||||
if (fByAccounts)
|
||||
{
|
||||
for (std::map<std::string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it)
|
||||
for (const auto& entry : mapAccountTally)
|
||||
{
|
||||
CAmount nAmount = (*it).second.nAmount;
|
||||
int nConf = (*it).second.nConf;
|
||||
CAmount nAmount = entry.second.nAmount;
|
||||
int nConf = entry.second.nConf;
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
if((*it).second.fIsWatchonly)
|
||||
if (entry.second.fIsWatchonly)
|
||||
obj.push_back(Pair("involvesWatchonly", true));
|
||||
obj.push_back(Pair("account", (*it).first));
|
||||
obj.push_back(Pair("account", entry.first));
|
||||
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
|
||||
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
|
||||
ret.push_back(obj);
|
||||
|
||||
Reference in New Issue
Block a user