Template specialization works with int and does not work with double class

I have the following simple template:

template<class T, T N> bool VerifyGT(T value) { return value > N; } bool (*test1)(int) = &VerifyGE< int, (int) 0>; // (1) bool (*test2)(double) = &VerifyGE< double, (double) 0.0>; // (2) 

At compilation: initialization test1 succeeds, test2 fails with "doesn not match required type". Any ideas?

+7
source share
1 answer

Unpaired template arguments cannot have a floating point type. Only integral types, enumerations, pointers, and references are allowed.

+10
source

All Articles