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?
#if defined(CALC_MODE)
and#elif defined(USER_MODE)
$elif defined(...)
? You may also find the#error
directive interesting.