If you want to read through all your maps in your map (...), you need two different iterators. One for a map <string, int> and one for a map<string, map<string, int> >.
So something like:
map <string, map <string, int> > foo;
// fill map
map <string, map <string, int> >::iterator outerit;
map <string, int>::iterator innerit;
for (outerit = foo.begin(); outerit != foo.end(); ++outerit){
for (innerit = outerit->second.begin(); innerit != outerit->second.end(); ++innerit){
cout << outerit->first << " " << innerit->first << " " << innerit->second << "\n";
}
}
Last edited by Nick Evan; Mar 27th, 2009 at 8:06 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Online 4,132 posts
since Oct 2006