P
PengYu.UT
I have the following in template class. I want doit() print the type
info. But it doesn't work. Could you please show me what is the correct
way to do that?
#include <iostream>
#define to_string( s ) # s
template <typename T>
class A {
public:
void doit(){
std::cout << to_string(T) << std::endl;
}
};
int main(int argc, char *argv[])
{
A<int> a;
a.doit();
}
info. But it doesn't work. Could you please show me what is the correct
way to do that?
#include <iostream>
#define to_string( s ) # s
template <typename T>
class A {
public:
void doit(){
std::cout << to_string(T) << std::endl;
}
};
int main(int argc, char *argv[])
{
A<int> a;
a.doit();
}