template<typename T, std::size_t N>
constexpr std::size_t arraySize(T (&)[N]) noexcept
{
return N; // and
}
(from the book Effective Modern C++)
arraySize returns the number of elements inside an array.
The parameter to the actual function is a reference to an array of type T with N elements in it.
But I don't understand how N is deduced, and why it even appears in the tags for the template.
arraysize(myArray);
How is N deduced from the above call?