When I try to print with it.first, it.second it does not work,
Are these even valid functions?
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
map<string, int> workers;
workers["John"] = 1;
workers["Frank"] = 2;
for(map<string, int>::iterator it = workers.begin(); it != workers.end(); ++it) {
cout<<it.first()<<":"<<it.second()<<endl;
}
return 0;
}
firstandsecondare no member functions, they are plain member objects:Note no parens, those are not function calls.