constexpr marks a function or variable that can be evaluated while compiling. A constexpr function called with constant arguments where a constant is needed, such as an array size, a constexpr variable or a static_assert, runs inside the compiler, and the program only contains the answer. Called with values known only at run time, the same function runs normally.
This is one way low-latency code moves work out of the hot path: powers of ten, fee tiers and lookup tables are computed once, at build time, and the running program reads them like constants. static_assert(condition, "message") checks a fact at compile time and stops the build if it is false.
Since C++20, constexpr functions can use loops, local variables, if and std::array. They cannot read input or call functions that are not constexpr, and undefined behavior, such as signed overflow, is a compile error inside them. The tests here store your results in constexpr variables, so a function that cannot run at compile time does not build.
A loop that runs inside the compiler; the program only contains 10000.