I have a header file that contains a class. Within that class, I have a function like so:
class Definition { public: int GetID() { return Id; } //Other methods/variables private: int Id; } When I attemped to get that ID as so:
for (std::map<Definition, std::vector<bool> >::iterator mapit = DefUseMap.begin(); mapit != DefUseMap.end(); ++mapit, defIndex++) { stream << "Definition " << (*mapit).first.GetID() << " Def Use" << endl << "\t"; } I get the following error
CFG.cc:1145: error: passing 'const Definition' as 'this' argument of 'int Definition::GetID()' discards qualifiers
is it because I'm using definition inside a map, and I'm not allowed to call methods on that mapped definition? Is there a way to get that ID variable out?
Thanks in advance