The C++ template system is quite possibly the worst functional programming language ever &#x27;designed&#x27;, with the exception of esolangs.  It would be so much saner if we could just run normal C++ code at compile time, with the ability to manipulate the main program&#x27;s types as values.  Then operations like this would simply be indexing a `std::vector&lt;Type&gt;`, there would be no need to add hacky special cases to the compiler and&#x2F;or massively increase compilation time, and it would be possible to do somewhat more complex things without going insane (e.g. a compile-time perfect hash table generator, like gperf but without needing an external tool).<p>Rust has something like this in the form of procedural macros, but it can&#x27;t manipulate types and values, only raw ASTs.  Apparently Nim can do it.