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

Use template dispatcher for vectortype choice #294

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

PhilipBAdams
Copy link
Contributor

@PhilipBAdams PhilipBAdams commented May 20, 2022

This PR changes the runtime vector type template selection technique from preprocessor to variadic template selection.

The change in approach has a few useful consequences

  1. We still define new enum/type pairs in DefinitionList.h, no need to define in multiple places
  2. When writing the code to be dispatched, we have access to editor language features, and don't need to escape newlines. So it is easier to spot mistakes.
  3. Compile errors give more informative messages about error location (instead of the line where macro is defined)
  4. Nested dispatch is simpler
  5. Less boilerplate code

However, we do have the main disadvantage that the new dispatch method is less intuitive. It may also impact the compile time, and we need to verify it has no performance impact.

@PhilipBAdams PhilipBAdams changed the title (WIP) Try using dispatcher instead of macro (WIP) Use template dispatcher for vectortype choice May 20, 2022
@PhilipBAdams PhilipBAdams marked this pull request as ready for review May 20, 2022 05:45
@PhilipBAdams PhilipBAdams changed the title (WIP) Use template dispatcher for vectortype choice Use template dispatcher for vectortype choice May 20, 2022
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.

None yet

1 participant