Skip to content

run clang-tidy with C++20#8188

Open
firewave wants to merge 3 commits intodanmar:mainfrom
firewave:tidy-cxx17
Open

run clang-tidy with C++20#8188
firewave wants to merge 3 commits intodanmar:mainfrom
firewave:tidy-cxx17

Conversation

@firewave
Copy link
Collaborator

@firewave firewave commented Feb 8, 2026

No description provided.

@firewave firewave changed the title run clang-tidy with C++17 run clang-tidy with C++20 Feb 8, 2026
@firewave
Copy link
Collaborator Author

firewave commented Feb 8, 2026

The idea here was that we might be able to address some of the findings by using conditional code.

@firewave firewave marked this pull request as ready for review February 26, 2026 08:46
@sonarqubecloud
Copy link

const std::string::size_type eq = config.find('=');
const std::string config2 = (eq != std::string::npos) ? config.substr(0, eq) : config + "=" + config;
const std::set<std::string>::iterator it2 = ret.find(config2);
const auto it2 = utils::as_const(ret).find(config2);
Copy link
Owner

Choose a reason for hiding this comment

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

what is the point of making it const? I find it a little weird to create the iterator for the const object and then comparing it to the end iterator of the non-const object. this is invalid if as_const would return a constant copy so it depends on a implementation detail..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what is the point of making it const?

So we get a const_iterator. Before it was mutable which was unnecessary. I added the constness. Unfortunately there is no cfind() and the result depends on the object.

I find it a little weird to create the iterator for the const object and then comparing it to the end iterator of the non-const object.

It is the same object. iterator and const_iterator can be compared which each other so end() and cend() are interchangeable. I have some local changes cleaning this up and also thought about filing tickets to detect such inconsistencies-

this is invalid if as_const would return a constant copy so it depends on a implementation detail..

It is not a copy - it is a cast.

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.

2 participants