my program wont compile because it did not found match for the operand. It accesses the map in struct Student, I am not sure if this is the exact way to access map.
my program wont compile because it did not found match for the operand. It accesses the map in struct Student, I am not sure if this is the exact way to access map.
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <map>
#include <list>
using namespace std;
struct Student {
string id;
map<string, int> scores;
};
istream& operator >>(istream &is, Sudent& g) {
auto it = g.scores.begin();
is >> g.id >> it->first >> it.second;
return is;
}
On >> it->first
I get this error:
Error: no operator ">>" matches these operands
operand types are: std::basic_istream<char, std::char_traits<char>> >> const std::string