C++ Language/Preprocessing/ConditionalCompilation
The traditional way to conditionally-compile code was to use #ifdef
or #if
.
But the preprocessor cannot reason about types, so modern code sometimes uses if constexpr
instead.
Additional information about conditional-compilation (includes interactive examples)