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

Figure out what to do with MapFactory #240

Open
dannys4 opened this issue Sep 20, 2022 · 1 comment
Open

Figure out what to do with MapFactory #240

dannys4 opened this issue Sep 20, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@dannys4
Copy link
Contributor

dannys4 commented Sep 20, 2022

Currently we have a list of files named MapFactory<k> for <k> in 1 through 15. This will make maintaining the code a bit of a chore, plus most of the code is repeated anyway. Unfortunately, partial template specialization of functions using Enums/ints to distinguish is impossible in C++17 (not that it's gotten any better since). Further, the options may not be known until runtime (e.g. from bindings).

However, we can most likely make a bunch of template specializations, which I think would cut down vs. what we have currently. We definitely could make some preprocessor directives to instantiate the template a bunch of times. Just an idea. Very low priority issue, though.

@dannys4 dannys4 added the enhancement New feature or request label Sep 20, 2022
@dannys4
Copy link
Contributor Author

dannys4 commented Sep 21, 2022

neat trick-- you can't do partial template specialization of functions with integers, but you can do them with structs. I can just make a functor class, and then use those partial template specializations as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant