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

[ranges.syn] Is #include <compare> redundant? #5631

Closed
frederick-vs-ja opened this issue Jul 21, 2022 · 3 comments
Closed

[ranges.syn] Is #include <compare> redundant? #5631

frederick-vs-ja opened this issue Jul 21, 2022 · 3 comments

Comments

@frederick-vs-ja
Copy link
Contributor

<compare> is (equivalently) required to be included by <iterator>, and <iterator> is required to be included by <ranges>, so it seems that the synopsis of <ranges> doesn't need to show #include <compare>.

@JohelEGP
Copy link
Contributor

It's definitely redundant. I don't know if this redundancy is accidental or intentional. How do other headers do it?

@jwakely
Copy link
Member

jwakely commented Jul 21, 2022

We explicitly say that <compare> is included in every header that needs it, so it's clear that the comparisons using it (and other comparisons using those) are well-formed.

I see no reason to "optimize" that by removing it where it's already implicitly included. What benefit would it have? It wouldn't make anything clearer.

Implementations are free to not re-include it unnecessarily, the difference is not observable.

@frederick-vs-ja
Copy link
Contributor Author

We explicitly say that <compare> is included in every header that needs it, so it's clear that the comparisons using it (and other comparisons using those) are well-formed.

Thank you. I think this is a clear reason to me that we should not remove #include <compare> even if it is redundant.

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

No branches or pull requests

3 participants