SPTAG
SPTAG copied to clipboard
Use template dispatcher for vectortype choice
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
- We still define new enum/type pairs in DefinitionList.h, no need to define in multiple places
- 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.
- Compile errors give more informative messages about error location (instead of the line where macro is defined)
- Nested dispatch is simpler
- 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.