Say I have overloaded functions with different arguments AND return types. Each set of argument has only one corresponding return type.
Vector grad(Scalar)
Tensor grad(Vector)
Later I have:
template <class T>
void test(T x) {
    ...  Y = grad(x) 
Then how do I automatically declare the type of Y. Do I need to make the grad function a template and specialize each of them ?
Thanks for any help