Skip to content

Conversation

@gxalpha
Copy link
Member

@gxalpha gxalpha commented Sep 30, 2025

Description

This is very dangerous as it propagates down everywhere the headers are included in.
Imo we should avoid using namespace std in general, but in headers it should be an absolute no-go.

Motivation and Context

I was baffled how this code works without std:: in front of find_if:

bool IsYouTubeService(const std::string &service)
{
auto it = find_if(youtubeServices.begin(), youtubeServices.end(),
[&service](const Auth::Def &yt) { return service == yt.service; });
return it != youtubeServices.end();
}

So I searched the entire source code to find if (pun intended!) there is anywhere where using namespace std is in a header.
The two spots I did find are in this PR. They do not affect the code above. I am still baffled. (but at least fixed the ones I did find).

Please tell me if you know why the above code works, haha.

How Has This Been Tested?

macOS 26, still compiles.

Types of changes

  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

This is very dangerous as it propagates down everywhere the headers are
included in.
@gxalpha gxalpha added the Code Cleanup Non-breaking change which makes code smaller or more readable label Sep 30, 2025
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

Good catch. Should probably explicitly fix that find_if separately.

@RytoEX RytoEX self-assigned this Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Cleanup Non-breaking change which makes code smaller or more readable

Projects

Status: Ready For Merge

Development

Successfully merging this pull request may close these issues.

4 participants