Bug 145538 - Use range based for loops
Summary: Use range based for loops
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.3.0 target:7.4.0 reviewed:20...
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2021-11-04 08:54 UTC by Hossein
Modified: 2023-03-17 14:26 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2021-11-04 08:54:10 UTC
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/
Comment 1 Commit Notification 2021-11-23 12:57:39 UTC
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.
Comment 2 Commit Notification 2021-11-23 13:43:41 UTC
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.
Comment 3 Commit Notification 2021-12-30 13:51:15 UTC
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.
Comment 4 Commit Notification 2021-12-30 20:44:37 UTC
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.
Comment 5 Commit Notification 2022-01-12 19:14:34 UTC
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.
Comment 6 Commit Notification 2022-01-17 19:50:41 UTC
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.
Comment 7 Commit Notification 2022-03-01 12:03:38 UTC
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.
Comment 8 Hossein 2022-06-21 13:53:42 UTC
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.
Comment 9 Commit Notification 2022-08-09 05:51:55 UTC
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.
Comment 10 Commit Notification 2022-08-26 20:38:10 UTC
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.
Comment 11 Commit Notification 2022-08-30 04:36:54 UTC
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.
Comment 12 Commit Notification 2022-10-07 12:42:34 UTC
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.
Comment 13 Commit Notification 2022-10-17 20:17:13 UTC
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.
Comment 14 Commit Notification 2022-11-06 00:26:35 UTC
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.
Comment 15 Commit Notification 2022-11-07 07:21:58 UTC
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.
Comment 16 Commit Notification 2022-12-19 16:40:15 UTC
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.
Comment 17 Commit Notification 2023-03-02 12:02:18 UTC
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.
Comment 18 Commit Notification 2023-03-11 11:26:04 UTC
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.
Comment 19 Commit Notification 2023-03-17 14:26:15 UTC
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.