Gast
2006-01-13, 21:44:51
Hi, ich habe ein einfaches key-value schema.
typedef multimap<string,string> str_str_mmap;
typedef multimap<string,str_str_mmap> str_mmap_mmap;
str_str_mmap current_map;
str_mmap_mmap big_map;
big_map.insert(make_pair(string("global"), current_map));
current_map.insert(make_pair(string("schluessel"), string("wert")));
big_map.insert(make_pair(label, current_map));
Soweit so gut, das funktoniert alles. Jetzt muss ich das nur noch in einer Schleife durchgehen.
Z.B. so irgendwie (Pseudocode):
for (i=0; i < big_map.size(); i++) {
cout << big_map[i].key << ": ";
temp_map = big_map[i].value;
cout << temp_map.key << " = ";
cout << temp_map.value << endl;
}
Aber mit den iteratoren komme ich da nicht vorwärts. Kann mir jemand sagen, wie das geht?
typedef multimap<string,string> str_str_mmap;
typedef multimap<string,str_str_mmap> str_mmap_mmap;
str_str_mmap current_map;
str_mmap_mmap big_map;
big_map.insert(make_pair(string("global"), current_map));
current_map.insert(make_pair(string("schluessel"), string("wert")));
big_map.insert(make_pair(label, current_map));
Soweit so gut, das funktoniert alles. Jetzt muss ich das nur noch in einer Schleife durchgehen.
Z.B. so irgendwie (Pseudocode):
for (i=0; i < big_map.size(); i++) {
cout << big_map[i].key << ": ";
temp_map = big_map[i].value;
cout << temp_map.key << " = ";
cout << temp_map.value << endl;
}
Aber mit den iteratoren komme ich da nicht vorwärts. Kann mir jemand sagen, wie das geht?