template<typename T> //T is a type which supports the dereference operator
void foo(T& param){
//the type of expression *param is defined at compile time
U = *param; //U is the type which *param returns
}
My question is: How can I implicitly determine the return type of performing an operation on an inputted generic type without explicitly indicating it in the function call? The return type of an operation is defined for each type I might use as a param, and is known at compile time.
for example
std::vector<int>::iterator svii;
foo(svii);
//type T is an iterator for a vector of ints
//type U would be int, the type returned by dereferencing the iterator, but how do I make the compiler determine that at compile time without specifiying it explicitly?