Attempting to use a template function with a single non-type template parameter
I tried a version of the prorgam that avoids recursion: #include <iostream> template <int N> constexpr int factorial() { int value = 1; // 0! = 1 for (int i = 1; i <= N; i++) { value *= i; } return value; } int main(int argc, const char * argv[]) { std::cout << factorial<5>()