diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2017-06-04 22:02:43 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2017-10-09 21:31:58 +0200 |
commit | 680bc2cbb34d6bedd0e64b17d0555216572be4c8 (patch) | |
tree | 49556f05754010cf334e67ed322e3a1dc6c29a64 /src/serialize.h | |
parent | c63364610f4a041df1c1bd81d01b1f6856160749 (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/serialize.h')
-rw-r--r-- | src/serialize.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/serialize.h b/src/serialize.h index eeb05fa76c..bb755c9b3d 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -732,8 +732,8 @@ template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m) { WriteCompactSize(os, m.size()); - for (typename std::map<K, T, Pred, A>::const_iterator mi = m.begin(); mi != m.end(); ++mi) - Serialize(os, (*mi)); + for (const auto& entry : m) + Serialize(os, entry); } template<typename Stream, typename K, typename T, typename Pred, typename A> |