Page MenuHomePhabricator

Merge #10493: Use range-based for loops (C++11) when looping over map elements
ClosedPublic

Authored by jasonbcox on Apr 4 2019, 21:07.

Details

Summary

680bc2cbb Use range-based for loops (C++11) when looping over map elements (practicalswift)

Pull request description:

Before this commit:

```c++
for (std::map<T1, T2>::iterator x = y.begin(); x != y.end(); ++x) {
    T1 z = (*x).first;
    …
}
```

After this commit:

```c++
for (auto& x : y) {
    T1 z = x.first;
    …
}
```

Tree-SHA512: 954b136b7f5e6df09f39248a6b530fd9baa9ab59d7c2c7eb369fd4afbb591b7a52c92ee25f87f1745f47b41d6828b7abfd395b43daf84a55b4e6a3d45015e3a0

Backport of Core PR 10493
https://github.com/bitcoin/bitcoin/pull/10493/files
Completes T577

Note: Many pre-patch lines in this diff do not match the original PR.
This is due to refactors that we've done and out-of-order backports.
If you are unsure, please git blame on master to find the associated refactor before this diff.
If you are still unsure, ask via a comment.

The changes in qt/bantablemodel.cpp were skipped because they were already applied in a past refactor.

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jasonbcox created this revision.Apr 4 2019, 21:07
Herald added a reviewer: Restricted Project. · View Herald TranscriptApr 4 2019, 21:07
Herald added a subscriber: schancel. · View Herald Transcript

The changes in qt/bantablemodel.cpp were skipped because they were already applied in a past refactor.

jasonbcox edited the summary of this revision. (Show Details)Apr 4 2019, 21:09
deadalnix requested changes to this revision.Apr 4 2019, 21:39
deadalnix added inline comments.
src/validation.cpp
4104 ↗(On Diff #7955)

I think it'd be good to figure out where that is coming from because that looks important and it's not from that patch.

This revision now requires changes to proceed.Apr 4 2019, 21:39
jasonbcox planned changes to this revision.Apr 5 2019, 16:03
jasonbcox added inline comments.
src/validation.cpp
4104 ↗(On Diff #7955)

My bad, it depends on D2732 which is where this change originates from. I did catch it during backporting, just forgot to rebase it at the end.

deadalnix accepted this revision.Apr 8 2019, 20:04
This revision is now accepted and ready to land.Apr 8 2019, 20:04
This revision was automatically updated to reflect the committed changes.