7

I hava a 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)

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

Paweł Szczur
  • 5,484
  • 3
  • 29
  • 32

1 Answers1

10

Non-type template arguments cannot be of floating-point type. Only integral types, enumerations, pointers and references are allowed.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455