int Wall_Distance(Hexa_Block<SOLN_STATE> Solution_Block){
int error_flag(0);
return error_flag;
}
which I specialize for a particular class as:
1 2 3 4 5 6
template <>
int Wall_Distance(Hexa_Block<FANS_State> Solution_Block){
/* a piece of code */
}
The templated class Hexa_Block can have a whole bunch of different specializations and FANS_State is one of them. However, I want the Wall_Distance function to do the exact "/* a piece of code */" only for a few specializations and for the rest I want it just to be a dummy.
Do I need to define it for all the specializations separately? Or is there a way to automate it somehow?
Thanks
template <SOLN_STATE>
int Wall_Distance(Hexa_Block<SOLN_STATE> Solution_Block){
int error_flag(0);
return error_flag;
}
I think I was unclear in my previous post. I need to do the exact /*piece of code */ specialization for 5 or 6 different class types of <SOLN_STATE>. Do I need to declare them separately, one for every class?
template <<SOLN_STATE>
You need a space between the left-pointing angle brackets, else the compiler will mistake it for the << operator, but that's an included detail.
Unless I'm misunderstanding something, then yes, you do. Don't forget to declare and implement the dummy, as well.