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 left QSortT() with std::sort() #7509

Merged
merged 8 commits into from Apr 18, 2019
Merged

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Apr 13, 2019

To sort arrays are replaced with std::array or std::vector depending on context.

@michicc
Copy link
Member

michicc commented Apr 13, 2019

Using std::array where possible is certainly a good idea. JFTR though, you can use std::sort on C arrays with std::begin and std::end.

@glx22
Copy link
Contributor Author

glx22 commented Apr 13, 2019

And of course OSX still uses QSortT()

@glx22
Copy link
Contributor Author

glx22 commented Apr 13, 2019

Used the easy way for OSX as I can't test it myself.

@glx22 glx22 force-pushed the array branch 2 times, most recently from 8f39b88 to 081f6fa Compare April 14, 2019 01:14
@LordAro
Copy link
Member

LordAro commented Apr 14, 2019

several of these std::arrays feel like they could be replaced with std::vector, and the _foobar_size globals could be removed as a result

Also, std::begin() & std::end() can be used on C-style arrays

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed - a few more usages of std::vector please :)

@glx22 glx22 force-pushed the array branch 3 times, most recently from 56f4526 to e2bf7dc Compare April 14, 2019 21:01
src/video/allegro_v.cpp Outdated Show resolved Hide resolved
src/settings_gui.cpp Outdated Show resolved Hide resolved
src/rail.h Show resolved Hide resolved
src/newgrf_config.cpp Outdated Show resolved Hide resolved
src/cargotype.cpp Outdated Show resolved Hide resolved
src/video/win32_v.cpp Outdated Show resolved Hide resolved
src/video/win32_v.cpp Show resolved Hide resolved
src/highscore.cpp Show resolved Hide resolved
src/industry_gui.cpp Outdated Show resolved Hide resolved
src/industry_gui.cpp Outdated Show resolved Hide resolved
@glx22 glx22 merged commit ebd4f32 into OpenTTD:master Apr 18, 2019
@glx22 glx22 deleted the array branch April 18, 2019 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants