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

PlayerManager: Move duplicate code into function in anonymous namespace #4582

Merged

Conversation

Holzhaus
Copy link
Member

No description provided.

@Holzhaus Holzhaus added this to the 2.4.0 milestone Dec 24, 2021
@Holzhaus Holzhaus force-pushed the playermanager-deduplicate-nextfreeplayer branch from 6dcec20 to 90f60bc Compare December 25, 2021 12:58
/// the corresponding `play` CO is set to 0.
template<class T>
T* findFirstStoppedPlayerInList(const QList<T*>& players) {
for (T* pPlayer : players) {
Copy link
Member

Choose a reason for hiding this comment

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

this could be const if BasePlayer::getGroup() was const (which it should be IMO).

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean this?

Suggested change
for (T* pPlayer : players) {
for (const T* pPlayer : players) {

This does not work, because in that case the return type would also have to be const. This would severly limit what you can do with the result (or you'd need to use const_cast which I consider a terrible hack).

Copy link
Member

Choose a reason for hiding this comment

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

Good point. I didn't think about that. LGTM me then.

@Holzhaus Holzhaus force-pushed the playermanager-deduplicate-nextfreeplayer branch from 90f60bc to d898e5e Compare December 25, 2021 13:22
Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

Thanks

@Swiftb0y Swiftb0y merged commit ab55358 into mixxxdj:main Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants