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

holds_alternative<T>, get<T> overconstrained #33

Open
pdimov opened this issue Jul 31, 2022 · 1 comment
Open

holds_alternative<T>, get<T> overconstrained #33

pdimov opened this issue Jul 31, 2022 · 1 comment

Comments

@pdimov
Copy link
Member

pdimov commented Jul 31, 2022

There's no good reason for these to not compile when T occurs more than once in the list of alternatives, as it's possible to make them work as expected. In the unlikely case the static_assert is desired, the user can easily write it himself.

@pdimov
Copy link
Member Author

pdimov commented Oct 5, 2022

The counterargument here is that in cases like variant<time_t, ptrdiff_t>, sometimes these can end up being the same type after porting the program to a different environment, and get<time_t> will silently succeed when code has (tried to) put a ptrdiff_t into the variant. At present, get<time_t> would fail to compile after the port, which would catch the problem.

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

1 participant