8.4 — Constexpr if statements
Normally, the conditional of an if-statement is evaluated at runtime. However, consider the case where the conditional is a constant expression, such as in the following example: #include <iostream> int main() { constexpr double gravity{ 9.8 }; // reminder: low-precision floating point literals of the same type can be tested …