The problem:
When you replace T
with const char *
, the function signature looks like this:
const char* sort<const char*>(const char** a, const char* n)
// ^^^ T* a -> const char ** a
Recommended:
Why is your signature template<typename T> T sort(T* a, T n)
anyways? You aren't returning anything, and you are treating n
as a size_t
. I recommend changing your signature to this:
template<typename T> void sort(T* a, size_t n);
And your specialization to:
template<> void sort<char>(char* a, size_t n);