Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codechange: Replace FOR_ALL_XXX with range-based for loops #7864

Merged
merged 24 commits into from Dec 21, 2019

Conversation

@glx22
Copy link
Contributor

glx22 commented Dec 18, 2019

No description provided.

glx22 added 23 commits Dec 14, 2019
Copy link
Member

LordAro left a comment

👍

* @param from index of the first Titem to consider
* @return an iterable ensemble of all valid Titem
*/
static Pool::IterateWrapper<Titem> Iterate(size_t from = 0) { return Pool::IterateWrapper<Titem>(from); }

This comment has been minimized.

Copy link
@LordAro

LordAro Dec 18, 2019

Member

perhaps a specific const variant could be useful as well?

typedef T* pointer;
typedef T& reference;
typedef size_t difference_type;
typedef std::forward_iterator_tag iterator_category;

This comment has been minimized.

Copy link
@LordAro

LordAro Dec 18, 2019

Member

these all seem to be unused? Or are they necessary for the iterator "type" ?

This comment has been minimized.

Copy link
@glx22

glx22 Dec 18, 2019

Author Contributor

They are necessary if we want to use the iterator in std algorithms like std::distance() or std::count_if().
But they are not needed for range-based for loops.

@glx22 glx22 force-pushed the glx22:iterator branch from 7073235 to 4527bc6 Dec 18, 2019
src/network/network.cpp Outdated Show resolved Hide resolved
src/road_cmd.cpp Outdated Show resolved Hide resolved
@nielsmh nielsmh merged commit e3c75a3 into OpenTTD:master Dec 21, 2019
8 checks passed
8 checks passed
OpenTTD CI Build #20191218.3 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.9) Linux linux-amd64-clang-3.9 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@glx22 glx22 deleted the glx22:iterator branch Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.