This is because array types decay into pointers when using a function as parameters or when they are passed as an argument to a function. In other words, your function signature is equivalent to :
template <typename T> inline T bigArry(const T* data)
A range-based for loop passes data to the global functions std::begin() and std::end() to get iterators to (respectively) the first and one last element of the container.
Of course, there are no global functions std::begin() and std::end() that take a pointer, and they also cannot be meaningfully defined: how to determine the end of a container specified only by a pointer to its first element?
You can use std::array instead of C arrays ( std::array is a zero-wrapper around the C array) and change your calling function accordingly:
template <typename T> inline T bigArry(std::array<T, 5> data)
Here is a living example .
source share