I have a templated function, which takes an array reference as a parameter:
template<typename T, int arrSize>
void foo(T (&pArr)[arrSize]) {
cout << "base template function" << endl;
}
I want to specialize this function for C-strings:
template<const char *, int arrSize>
void foo(const char * (&pArr)[arrSize]) {
cout << "specialized template function" << endl;
}
I try to instantiate the base and the specialization:
int main(int argc, const char **argv) {
float nums[] = {0.3, 0.2, 0.11};
const char *words[] = {"word1", "word2"};
foo(nums);
foo(words);
}
But I only seem to get the base instantiation:
./foo
base template function
base template function
I have compiled this on a Mac using clang++ with -std=c++17.