Replace BOOST_FOREACH with C++11's for loop #8718

issue rodentrabies opened this issue on September 13, 2016
  1. rodentrabies commented at 11:28 PM on September 13, 2016: contributor

    As there is a general movement towards c++11, can BOOST_FOREACH macro be replaced with c++11's for(<variable> : <container>) syntax everywhere throughout the codebase? Did some replacements with sed on my laptop and everything seems to work fine. Be glad to submit PR for this in couple of hours, if everything is ok.

  2. JeremyRubin commented at 5:02 AM on September 14, 2016: contributor

    @yurizhykin people are usually opposed to such batch changes as they make a big diff which is likely to step on the toes of a lot of other works in progress.

    The flow I usually see is incrementally removing such parts until a few remain, then removing them all.

    (If you look, no recently modified code should be using BOOST_FOREACH)

  3. jonasschnelli added the label Refactoring on Sep 14, 2016
  4. jonasschnelli commented at 6:29 AM on September 14, 2016: contributor

    Agree with @JeremyRubin

  5. laanwj commented at 8:23 AM on September 14, 2016: member

    It make sense to do this only after the other, more involved parts of boost have been replaced.

    If you want to help with that please help with testing and reviewing pulls such as #8631 (threading) and #8670/#8650 (replacing the test framework).

    I agree with @JeremyRubin and @jonasschnelli that this can wait. At this point it'll just break patches and make backporting more annoying.

    (though feel free to do this if there is code that you need to touch anyway).

  6. laanwj closed this on Sep 14, 2016

  7. laanwj cross-referenced this on Sep 25, 2016 from issue [trivial] Switching from Boost for-each macros to C++11 for-each by tjps
  8. MarcoFalke cross-referenced this on Jan 5, 2017 from issue Trivial refactor: BOOST_FOREACH(a, b) -> for (a : b) by kallewoof
  9. laanwj removed this from the "Later" column in a project

  10. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC