Monday, 2 April 2018

c++ - no operator '>>' matches these operands

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 
#include
#include
#include
#include
#include
#include



using namespace std;

struct Student {
string id;
map 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> >> const std::string

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...