Answer the question
In order to leave comments, you need to log in
Is it possible to make code that, if the constexpr expression is true, will issue a warning?
Task: display a warning in the log when debugging occurs: logging, imitation of rare code branches, and the like.
For what? - so that the programmer does not let the program into production in debug mode.
inline void dbg() {}
/// [+] simulate changed horizon when actually it did not
constexpr bool SIMULATE_CHANGED_HORIZON = false;
inline bool chgNot(bool x) {
if constexpr (SIMULATE_CHANGED_HORIZON) {
dbg();
return x;
} else {
return !x;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question