I have something like this in my code:
template <typename T>
struct A
{
  void Print();
};
template <>
struct A<char*>
{
  void Print() { printf("Char*!\n"); }
};
template <typename T>
void DoSomething(T& lol)
{
  A<T> a;
  a.Print();
}
int main()
{
  char a[5];
  DoSomething(a);
}
And this produces the following linker error:
error LNK2019: unresolved external symbol "public: void __thiscall A<char [5]>::Print(void)" (?Print@?$A@$$BY04D@@QAEXXZ) referenced in function "void __cdecl DoSomething<char [5]>(char const (&)[5])" (??$DoSomething@$$BY04D@@YAXAAY04$$CBD@Z)
What type should I specialize the A template for, so that I can use it with a array-of-char? I tried const char* and other combinations of const, char, * and &, and nothing works.
Note that I cannot change the DoSomething function.
Also, if possible, I would like the compiler to automatically deduce (or convert) the template type without specifying it in the DoSomething<smth>() call in main().