Monday, April 2, 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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...