Created
July 18, 2018 18:43
-
-
Save tonyyang-svail/3b30d6f44b8472f464c1b390cc49de31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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