Arrays are Evil!
what you want is a std::map<std::string, std::map<std::string, int> > (not the space in between the last two angle brackets, it is required).
there is a
for_each in the STL <functional> header. It's a bit complicated by itself, but with boost::lambda and/or boost::bind it's a win.