Here are two overloading declarations of a function:
void fun(char& arg);
void fun(int& arg);
void fun(long& arg);
The definitions are doing the same job:
void fun(char& arg) { ++arg; }
void fun(int& arg) { ++arg; }
void fun(long& arg) { ++arg; }
How to declare and define the function once by using template, which accepts only int, char and long types for the argument? Error should appear as soon as possible (before runtime) if the function is misused (e.g. a variable of double type is passed).