As an experiment, I just put together the code to generate std::array<uint32_t, 256> at compile time. The contents of the table are a fairly typical CRC lookup table - the newer is the use of constexpr functions for calculating records, and not for placing an automatically generated magic table directly in the source code.
In any case, this exercise aroused my curiosity: were there any practical restrictions on the number of calculations that the compiler would like to do to evaluate the constexpr function or variable definition at compile time? for example, something like the gcc -ftemplate-depth parameter, which creates practical limits on the amount of metaprogramming evaluation of a template. (I also wonder if there can be practical limits on the length of the parameter package, which would limit the size of the compilation time std::array created using the std::integer_sequence intermediate object.)
source share