On Aug 13, 2025, at 9:41 PM, 叶易安 via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
C++26 `static reflection` proposal wanna to bring a syntax called `template for`. We know that C++17 introduced one similar thing called `if constexpr`, So why not make the style unified and call it `for constexpr` ?
template for is not a constexpr, so this would be incorrect.
`if constexpr` is an if that is guaranteed to be evaluated at compile time, template for is just a for loop where each “iteration” may have a different type. The type unrolling occurs at compile time, but the body of the for loop is not evaluated at compile time, which is what constexpr would be saying.
—Oliver