#include <map> 
#include <string> 
#include <iostream> 
  
struct point 
{ 
    float x; 
    float y; 
}; 
  
int main() 
{ 
    std::map<std::string, point> m; 
  
    // Einfügen über operator [] 
    m["Blubb"] = point{435.6, 234.2}; 
  
    // Einfügen über insert 
    m.insert(std::make_pair("FooBar", point{654.3, 345.8})); 
    
    // Auslesen über operator [] 
    // Wenn noch nicht in map wird ein point default-initialisiert angelegt. 
    auto& p1 = m["FooBar"]; 
    auto& p2 = m["DoesNotExistYet"]; 
    std::cout << "FooBar" << ": " << p1.x << " - " << p1.y << '\n'; 
    std::cout << "DoesNotExistYet" << ": " << p2.x << " - " << p2.y << '\n'; 
  
    // Auslesen über find (wenn man wissen will, ob ein Eintrag überhaupt existiert oder nicht) 
    auto found = m.find("Blubb"); 
    if (found != m.end()) 
        std::cout << found->first << ": " << found->second.x << " - " << found->second.y << '\n'; 
}