I'm learning templates and I noticed that I cannot seem to declare and define a template separately. With a function, I'd declare it before main and define it after main to keep good readability. But it seems like I have to write the whole template at once, and before main. But I want my main function to be at the top. Surely there would be a way to do this but I couldn't find it.
'''
#include <iostream>
using std::cout;
using std::endl;
template <typename T>
void Print(T a);
int main(void)
{
Print("Hey");
// free variables
return 0;
}
void Print(T a)
{
cout << a << endl;
}
'''