Is that what you do?
#include <typeinfo>
#include <iostream>
template <typename T>
struct S {
};
int main() {
S <int> a;
S <int> & object = a;
const std::type_info & ObjT = typeid( object );
std::cout << "******the objT is: "<< ObjT.name() << std::endl;
}
This works for me with GCC 4.5.1.
source
share