Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
typeid is a C++ keyword to determine a class type at runtime.
#include <cassert> #include <string> #include <typeinfo> int main() { assert(std::string(typeid(int).name())=="i"); assert(std::string(typeid(double).name())=="d"); assert(std::string(typeid(std::string).name())=="Ss"); }