The decay of the array is not easy - it happens only when the program cannot be compiled without it. When you pass an array by reference, there is simply no need to decompose.
Note that a function template can also be written without dividing ugly sizeof expressions:
template <typename T, std::size_t N> std::size_t size_of_array(T (&array)[N]) { return N; }
When the client calls size_of_array , T and N automatically output by the template engine.
source share