Question Define the template function template <typename T1, typename T2> int count_range(T1 a[], T2 size, T1 low, T1 high) that returns the number of times a value between low and high (inclusive) occurs in a. For instance, count_range(arr, 6, 2, 4) would return 4. Test your function in your main(). Write a comment explaining which operations the types T1 and T2 need to support for your code to work. Test the function in main using an array of ints, and an array of strings.

DS7MXV The Asker · Computer Science

Define the template function

template <typename T1, typename T2>

int count_range(T1 a[], T2 size, T1 low, T1 high)

that returns the number of times a value between low and high (inclusive) occurs in a. For instance, count_range(arr, 6, 2, 4) would return 4. Test your function in your main(). Write a comment explaining which operations the types T1 and T2 need to support for your code to work. Test the function in main using an array of ints, and an array of strings.

More