I have a template class which is used to store variables and then print them as strings
what I want is to have my class produce the string to represent the type automatically
Currently an instance of the class must be declared as
CValue<int> foo("Name", "int", 56);
I would like to reduce that to
CValue<int> foo("Name", 56);
the ouput from both functions should be
This means having a function to get the "int" from <int>
what I was trying is
template <class _T>
std::string GetType(_T me)
if (int i = dynamic_cast<int>(me))
else if(char c = dynamic_cast<char>(me))
this of course doesn't work since dynamic_cast isn't designed for that sort of thing
Can anyone give me a way of getting this function to work?
i.e. a function like below
std::string s = GetType(a);
// s = "int"
s = GetType(c);
// s = "char"