aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-06-04 22:02:43 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-10-09 21:31:58 +0200
commit680bc2cbb34d6bedd0e64b17d0555216572be4c8 (patch)
tree49556f05754010cf334e67ed322e3a1dc6c29a64 /src/addrman.h
parentc63364610f4a041df1c1bd81d01b1f6856160749 (diff)
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) { }
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/addrman.h b/src/addrman.h
index 18f3062287..e58fb4a369 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -313,9 +313,9 @@ public:
s << nUBuckets;
std::map<int, int> mapUnkIds;
int nIds = 0;
- for (std::map<int, CAddrInfo>::const_iterator it = mapInfo.begin(); it != mapInfo.end(); it++) {
- mapUnkIds[(*it).first] = nIds;
- const CAddrInfo &info = (*it).second;
+ for (const auto& entry : mapInfo) {
+ mapUnkIds[entry.first] = nIds;
+ const CAddrInfo &info = entry.second;
if (info.nRefCount) {
assert(nIds != nNew); // this means nNew was wrong, oh ow
s << info;
@@ -323,8 +323,8 @@ public:
}
}
nIds = 0;
- for (std::map<int, CAddrInfo>::const_iterator it = mapInfo.begin(); it != mapInfo.end(); it++) {
- const CAddrInfo &info = (*it).second;
+ for (const auto& entry : mapInfo) {
+ const CAddrInfo &info = entry.second;
if (info.fInTried) {
assert(nIds != nTried); // this means nTried was wrong, oh ow
s << info;