With Java varags, all parameters are of the same type. It is basically the same as passing an array and it's size.
So you might use something like this instead:
void foo(int *arr, size_t size);
void foo(std::vector<int>& arr);
Limiting templates to specific types only is just not the intention of templates. But it is possible and has been asked before:
c++ - Restrict variadic template arguments - Stack Overflow[
^].