Recursive call vs while loop

I don’t think this is what the OP is getting from. In C++ templates must be resolved at compile time, so with template meta-programming (and now constexpr (for expressions, from C++11) and consteval (for functions, from C++20)) you get the security and promise that the expression or functions must be resolved at compile time.

(Edit: sorry, didn’t read the date of the post, it just appear in my feed and I jumped in. :sweat:)