In my project, the program can do one thing of two, but never both, so I decided that the best I can do for one class is to define it depending of a #define preprocessor variable. The following code can show you my idea, but you can guess that it does not work:
#ifdef CALC_MODE
typedef MyCalcClass ChosenClass;
#elifdef USER_MODE
typedef MyUserClass ChosenClass;
#else
static_assert(false, "Define CALC_MODE or USER_MODE");
#endif
So I can do
#define CALC_MODE
right before this.
I can resign the use of static_assert
if needed. How can I do this?
Here's a suggestion, based largely on comments posted to your question:
#if defined(CALC_MODE)
typedef MyCalcClass ChosenClass;
#elif defined(USER_MODE)
typedef MyUserClass ChosenClass;
#else
#error "Define CALC_MODE or USER_MODE"
#endif