mercredi 28 juin 2017

ArraySize of const char* [] with template function

I'm trying to find the size of an array with the type const char * [] with a function :

template<typename T, std::size_t N>
constexpr std::size_t arraySize(const T* (&)[N])
noexcept
{
   return N;
}

I have the error:

template argument deduction/substitution failed:
mismatched types ‘const T* [N]’ and ‘const char* []’

Aucun commentaire:

Enregistrer un commentaire