I've got a question regarding a (future, potential) metaprogramming facility -- namely, a possibility of standardizing static loops. It might go hand in hand with adding static conditional expressions (like the proposed static_if) to the future versions of the standard.
In particular, it discusses examples that "explain how metaprogramming can be used to speed up the calculation of the power function when the exponent is an integer known at compile time."
"In C++ template metaprogramming, loops are implemented as recursive templates.
Why is template metaprogramming so complicated? Because the C++ template feature was never designed for this purpose. It just happened to be possible.
The D language allows compile-time if statements (called static if), but no compile- time loops. We can only hope that such a feature becomes available in the future. If a future version of C++ should allow compile-time if and compile-time while loops, then the transformation of example 15.1b to metaprogramming would be straightforward. The MASM assembly language has full metaprogramming features, including the ability to define function names and variable names from string functions. A metaprogramming implementation analogous to example 15.1b and d in assembly language is provided as an example in the "Macro loops" chapter in manual 2: "Optimizing subroutines in assembly language"."
Right now we can (awkwardly) implement conditionals using template specialization and loops using recursive template instantiation. I understand the proposed static_if facility is intended to avoid the awkwardness in the case of the compile-time if statements. Would it be possible for the next revision of the standard to get an analogous (as described above) compile-time loops extension?