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

Unnecessary default constructor overloading #43

Open
jwakely opened this issue Jul 18, 2024 · 1 comment
Open

Unnecessary default constructor overloading #43

jwakely opened this issue Jul 18, 2024 · 1 comment
Assignees

Comments

@jwakely
Copy link

jwakely commented Jul 18, 2024

https://github.com/beman-project/Optional26/blob/bfeb9080c0d9c501965ae857a1decf7ed74686f5/include/Beman/Optional26/optional.hpp#L325-L331

Is there any benefit to the defaulted constructor? Why define it twice? The default member-initializers mean it's never trivial, even if defined as defaulted.

Unless I'm missing something, it looks like this could be simply:

constexpr optional() noexcept {}

@steve-downey
Copy link
Member

I don't think there's a requirement for optional to be trivial, so I don't think that's it. It may have been an older compiler being unhappy. Will change and confirm in tests.

@steve-downey steve-downey self-assigned this Jul 18, 2024
@steve-downey steve-downey mentioned this issue Jul 22, 2024
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

2 participants