Since C++11, range based loops are available for iterating over a known range of values. For example, when there is a need to process elements of a container, range based loops are usually a good choice. They are easy to write, read and understand. This EasyHack is about using range based loops when it is more appropriate. This is an example where range based loop was better suited: Use range based for loops https://git.libreoffice.org/core/+/47728bb925b33a8fe536fed8c913a2669bf101b6 Make sure that you understand where to use reference or const reference if needed. A suggested reading: https://blog.knatten.org/2013/10/13/prefer-using-references-with-range-based-for-loops/
Henrik Palomäki committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6f435016092953478b5636fe9078866500fc7b90 tdf#145538 Use range based for loops It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Harjot committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/34a0f7023aad59bc054385f0593606d5d602e052 tdf#145538 Use range based for loops in EnhancedShapeDumper.cxx It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Ramreiso Kashung committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7886b6a56a51cb699fb2a18d8a8dff0e224bdfb5 tdf#145538 : Using range-based for loops It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Ankur Khandelwal committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/96882cdec23c64974737c4833f157d54b85a129e tdf#145538 Use range based loops It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
dtm committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/582bf1a27c5adc6684e8d9af3805cfe40fa051d5 tdf#145538 - Use range based for loops It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
VaibhavMalik4187 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/e7b01e4a5a856543e85f614c82950122e9598518 tdf#145538 - Use range based for loops It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Deep17 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/f63a6f2e396fa41ed1338dcec874e06159cafa9f tdf#145538 - Use range based for loops It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Re-evaluating the EasyHack in 2022 This issue is still relevant, as there are many places in the code that range based for loops can be used.
Stanislav Lopatin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/815851d1cbc427bbd85da1638f3b121b253d0926 tdf#145538 Change common loops to range based in ScanlineToolsTest.cxx It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
PoonamShokeen committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/08a63a88543b0da68380090b655e777bd2b980be tdf#145538 Use range based for loops It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Stanislav Lopatin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/91f91815124c00727eefdd92fbed2d927faaf60b tdf#145538 Change common loops to range based. It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andrea Rosetti committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/e005259a6d4e237411c1b4adfb1b63313bcc5980 tdf#145538 use range based for loops It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
OmkarAcharekar committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7b63242ea72885d05faa5f0879395fa93a3446d1 tdf#145538 - Use range based for loops It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
jsala committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/64469bb1a7383da6e7ff1150d693b3e08f54bc91 tdf#145538 Use range based for loops It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Hossein committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/acf7a851e87ec993ae828ccbf1bfb25448e88423 Revert "tdf#145538 Use range based for loops" It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Leonid Ryzhov committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ed9eef72e0f616b9c626629c4233b725ca5506ce tdf#145538 Use range based for loops It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
mostafa-elsharnoby committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/5d2be45a788c450e6f914eea8c3b74d214edaccd tdf#145538 Use range based for loops It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
gokulakrishnan-shankar committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/20a5e38ee279022b7e6fbc32d2d259738244c0fd tdf#145538 Refactor to use range-based for-loops It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
anfanite396 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/34f7c8cce9c16861940f403f9a633fe8b26ba4ad tdf#145538 Use range based for loops It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.