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
Personally, I'd prefer using static class members over functions for this sort of thing:
template struct max;
template struct max {
static const int value = max::value>::value;
};
template struct max {
static const int value = N > M ? N : M;
};
int main()
{
return max<1,2,3>::value;
}
Update: Using ildjarn's suggestion, here's the less verbose version:
#include
template struct max;
template struct max
: std::integral_constant::value>::value> { };
template struct max
: std::integral_constant M ? N : M)> { };