#include <iostream> #include <string> #include <vector> #include <map> #include <typeinfo> #include <typeindex> int main(int argc, char *argv[]) { //index std::cout<<std::type_index(typeid(int)).name()<<std::endl; std::cout<<std::type_index(typeid(double)).name()<<std::endl; std::string name; std::cout<<std::type_index(typeid(name)).name()<<std::endl; std::vector<std::string> stringContainer; std::vector<int> intContainer; std::cout<<std::type_index(typeid(stringContainer)).name()<<std::endl; std::cout<<std::type_index(typeid(intContainer)).name()<<std::endl; //map std::map<std::type_index, std::string> m; m[std::type_index(typeid(int))] = "int"; int n; std::cout<<m[std::type_index(typeid(n))]<<std::endl; std::map<std::type_info, std::string> m2; //m2[typeid(int)] = "int";//error return 0; }