正常
constexpr and Compile-Time Computation
If a computation's result can already be determined at compile time, why wait until runtime to do it? constexpr makes it possible to evaluate functions and variables during compilation, and consteval and constinit go further, providing hard compile-time guarantees. In this chapter we start from the basics of constexpr, work through the design constraints of literal types and constexpr constructors, pick up the new C++20 tools, and finally put everything to work in practice with compile-time lookup tables, string processing, state machines, and design patterns, before landing it all in embedded scenarios.