Compile-time Constants constexpr

Medium C++ Architecture
Solve this problem

Create a C++ constexpr system to compute constants at compile time for lookup tables. Use constexpr functions and arrays.

Constraints

  • constexpr factorial.
  • constexpr LUT array.
  • static assert correctness.
  • No runtime cost.
Starter codeC++
1constexpr int fact(int n);