I have a variadic template function which calls itself to determine the largest number in a list (constituted by the templatized arguments). I am trying to make a specializa
I see two mistakes using clang.
Put the overload taking a single int first.
Make things unambiguous for lists of length 1. Recall that variadic lists can have zero size and when they do, it seems to me you have an ambiguity.
This compiles and runs correctly for me:
#include
using namespace std;
template
int tmax() {
return N;
}
template
int tmax() {
return N > tmax() ? N : tmax();
}
int main() {
cout << tmax<32, 43, 54, 12, 23, 34>();
}
54