C++ Loop through Map

You can achieve this like following : map<string, int>::iterator it; for (it = symbolTable.begin(); it != symbolTable.end(); it++) { std::cout << it->first // string (key) << ‘:’ << it->second // string’s value << std::endl; } With C++11 ( and onwards ), for (auto const& x : symbolTable) { std::cout << x.first // string (key) << … Read more