# **[](https://en.cppreference.com/w/cpp/header/typeindex)** provides `std::type_index`, a hashable wrapper around `std::type_info` from ``. Use it to store types in containers like `std::map` or `std::unordered_map`. You rarely need this; it's mainly useful for dynamic type dispatch or plugin systems. ## Example This example uses type_index as a map key to associate types with their string names. ```cpp // compile: g++ -std=c++11 -o typeindexexample typeindexexample.cpp // run: ./typeindexexample // description: use types as map keys #include #include #include int main() { std::map type_names; type_names[std::type_index(typeid(int))] = "integer"; type_names[std::type_index(typeid(double))] = "floating point"; std::cout << "int is: " << type_names[std::type_index(typeid(int))] << "\n"; return 0; } ```