Consider the following code
template <typename T, T one>
T exponentiel(T val, unsigned n) {
T result = one;
unsigned i;
for(i = 0; i < n; ++i)
result = result * val;
return result;
}
int main(void) {
double d = exponentiel<double,1.0>(2.0f,3);
cout << d << endl;
return 0;
}
The compiler tells me this no matching function for call to 'exponentiel(float, int)'
Why?
What's strange is that exponentiel works with int.