So for example I want to create a function that add two numbers and return total.
template<typename T1, typename T2>
T1 add( T1 n1, T2 n2 ){
return n1 + n2;
}
Problems is if T1 is int and T2 is float. Then function will return int. But I want it to return float. Is there a trick or a way to achieve it?