56. PairSum Multiple Template Parameters

Write a function template pairSum that takes two values of possibly different types and returns their sum:

  • template<typename A, typename B> auto pairSum(A a, B b) -> decltype(a+b)
  • The function should return a + b.

The program already reads two numbers (they may be of different types) and calls pairSum.
 You only need to implement the template function.
 

Example
 Input:

5 7

Output:

12

 

Input:

3 2.5

Output:

5.5

 

Input:

10.5 4

Output:

14.5
Loading...

Input

5 7

Expected Output

12