vendredi 19 février 2021

How can I most effectively and elegantly let the user decide which package to use for a custom framework? [closed]

I am building a framework in C++ which relies heavily on high performance mathematical operations, and want to integrate packages like Intel's MKL, CBLAS, and so forth in the framework, alongside some default operations that do not rely on any packages. I want to give the user the functionality of declaring which package to use, depending on a variable, or #define, or anything that the user can enter, and for the program to compile using those specific functions (or achieve a similar effect). Other than the identifier, rest of the program should remain the same, so it should be possible for the user to swap out various methods of packages in a single line or so. I am aware of using #ifdef's but also wondering if there are better methods for this. Also since in C++20 modules are being introduced, I am not sure how effective #ifdefs will be in the first place

Aucun commentaire:

Enregistrer un commentaire