I have a template class that takes a name in its constructor. The name is supposed to be the name of the actual type, so that it can be put into a human-readable list or something.
Anyways I am currently defining the types like this:
typedef templateClass<someType> someTypeClass;
However, in order for the name to be also "someTypeClass" I would need the user to always specify that name correctly. Rather I want some way to force the constructor parameter to always be "someTypeClass" (FOR THAT SPECIFIC TYPE SPECIALISATION).
The purpose of the name parameter is to have a way of knowing the name of a template specialisation. Here a example
template<class t>
class TemplateClass{
private:
std::string name;
t data;
public:
TemplateClass(const char* name);
/*Irrelevant*/
};
typedef TemplateClass<int> intType; //name should be "intType" but how can I force the name to be "intType" for this case? I dont want the user to have to type "intType" for every instance he wants to make
typedef TemplateClass<char> charType; //name should be "charType"
Is this achieveable in some viable way or is there a better way to go about this?