#include #include #include using namespace std; template string name(); //general-purpose template deliberately undefined template <> inline string name() {return "char";} template <> inline string name() {return "int";} template <> inline string name() {return "double";} //etc. template inline void print(const T& t) { cout << static_cast(&t) << ": " << name() << " (" << sizeof (T) << " bytes) " << t << "\n"; } int main() { char c = 'A'; int i = 10; double d = 3.14; print(c); print(i); print(d); return EXIT_SUCCESS; }