These two non-variadic function templates do compile:
template
typename std::enable_if::value, v
Or you could simply make use of additional variadic pack to test if all template arguments are the same and equal to a given type (C++11):
#include
#include
template
struct pack { };
template
typename std::enable_if, pack>::value, void>::
type testFunction(T a, U... bs) {
std::cout << "bs are integers\n";
}
template
typename std::enable_if, pack>::value, void>::
type testFunction(T a, U... bs) {
std::cout << "bs are floats\n";
}
int main() {
testFunction(1, 2, 3, 4, 5);
testFunction(1, 2.0f, 3.5f, 4.4f, 5.3f);
}
[live demo]
Output:
bs are integers
bs are floats