¿Cómo afirmar que una cláusula constexpr si no ocurre nunca?
Quiero generar un error de tiempo de compilación cuando no sea de constexpr si las condiciones son verdaderas, por ejemplo:
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);