Skip to content

Instantly share code, notes, and snippets.

@tonyyang-svail
Created July 18, 2018 18:43
Show Gist options
  • Save tonyyang-svail/3b30d6f44b8472f464c1b390cc49de31 to your computer and use it in GitHub Desktop.
Save tonyyang-svail/3b30d6f44b8472f464c1b390cc49de31 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <typeinfo> //for 'typeid' to work
#include <typeindex>
using namespace std;
class Base {};
int main() {
cout << typeid(Base).name() << endl; // 4Base
cout << type_index(typeid(Base)).name() << endl; // 4Base
cout << typeid(type_index(typeid(Base))).name() << endl; // NSt3__110type_indexE
cout << type_index(typeid(type_index(typeid(Base)))).name() << endl; // NSt3__110type_indexE
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment