... или для любителей запутанного кода ...

у вызвать ошибку времени компиляции, если не в constexpr, если условия выполняются, например:

if constexpr(condition1){
    ...
} else if constexpr (condition2) {
   ....
} else if constexpr (condition3) {
  ....
} else {
    // I want the else clause never taken. But I heard the code below is not allowed
    static_assert(false);
}

// I'd rather not repeat the conditions again like this:
static_assert(condition1 || condition2 || condition3);

Ответы на вопрос(3)

Ваш ответ на вопрос