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

Unwrap EventHandler enums #1225

Merged
merged 10 commits into from
Feb 13, 2025
Merged

Unwrap EventHandler enums #1225

merged 10 commits into from
Feb 13, 2025

Conversation

DanRStevens
Copy link
Collaborator

@DanRStevens DanRStevens commented Feb 13, 2025

The EventHandler enums should be free standing enums, rather than wrapped up inside the EventHandler class.

One of the problems with wrapping, is the ineffectiveness of explicit template instantiation for Signal types taking those enums as parameters. When the enums are part of the class, the explicit template instantiation declarations need to come after the class. Unfortunately, this also puts those declarations after the fields of that type. Hence it is too late to prevent implicit instantiation for those fields.

As a side note, the previous namespace scoping was a bit excessive. This change allows shortening of NAS2D::EventHandler::KeyCode::KeyValueName to NAS2D::KeyCode::KeyValueName.

Related:

Add `using` aliases for backwards compatibility.
There should be a positional correspondence between `KEY_FIRST` and `KEY_LAST`.
The file rename already breaks source compatibility, so an update is needed anyway.
Remove corresponding `NAS2D::` prefix from definition.
It looks like a block comment, but you definitely don't want to add things to the end of the block.
@DanRStevens DanRStevens merged commit ad39706 into main Feb 13, 2025
8 checks passed
@DanRStevens DanRStevens deleted the unwrapEventHandlerEnums branch February 13, 2025 22:52
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.

1 participant