I think you're confusing this with C-style strings.

A normal strlen-esque implementation may look something like this:
Code:
std::size_t StringLength(const char* str)
{
    const char* offset = str;
    
    for(; *offset; ++offset);
    
    return offset - str;
}
Arrays decay to pointers, so size information is lost. This is something that the caller becomes responsible for providing.

If you're working with stack based arrays, you can in fact do what you wanted in your OP:
Code:
template<typename T, std::size_t size> std::size_t GetSize(const T(&)[size])
{
    return size;
}