But it gives me,
At line 1 => 'class std::basic_string<char>' is not a valid type for a template no type parameter.
At line 5 => 'K' does not name a type.
Could someone please help ? Must be a silly mistake.
Indeed, you can't use string as a template parameter. You can only use "typename T", "class T", or integral constants.
You also can't use K as a type like that. You've defined K to be an int. K, in this context, can only be used as a integral constant, not as a generic type.
Your code is a bit strange, what are you trying to achieve here by using templates? Why not just do
My bad. Thanks for your answer. I really appreciate that. By the way, its a sub class of another class where both of their member functions use these types a lot.