Deduce non-type template parameter
- by pezcode
Is it possible to deduce a non-type template parameter from a template function parameter?
Consider this simple template:
template <int N> constexpr int factorial()
{
return N * factorial<N - 1>();
}
template <> constexpr int factorial<0>()
{
return 1;
}
template <> constexpr int…