I don't like to put the function definitions in the header either, but, unfortunately, it's usually necessary with template classes. I've never used explicit instantiation (nothing wrong with it--I've just never needed it), so I am not sure what the syntax is for using it.
What I do, however, is create a ".tcpp" file with all of the template code that would go into a .cpp file if it weren't templated. Then I include the .tcpp file at the end of the header file. This satisfies the compiler, and fits within my sensibilities of what I like to see in a header file. And the .tcpp extension lets me know that it contains template code that cannot be compiled directly. So, something like this:
#include "Helper.h" // Not needed, but it helps the file feel like a .cpp file
template <size_t N>
void compare(string name, string stringVals[][N]){
do some processing using stringVals and name
}
because I'm unable to do explicit instantiation, I would like to also see the code that uses explicit instantiation.
The about case I have can be taken as an example
And also .. I have tried using std:vector but assigning values to 2D vector doesn't seem to be as easy and simple as it is for a multidimentional arrays or am I wrong?