'Error: Cannot assign to return value because function 'operator-> ' returns a const value [duplicate]
I'm working on an app for school and I ran into a problem.
void giveByePoint(std::set<Player>::iterator &player){
player->byePointGiven = true;
}
When i try to do this it gives me the error "Cannot assign to return value because function 'operator-> ' returns a const value" and I don't understend why. I am not passing the variable as const. Here is the definistion of my function in the header.
void giveByePoint(std::set<Player>::iterator player);
And thia is the definition of the variable in my class
class Player{
public:
...
bool byePointGiven;
...
}
And then I initiate it in the constructor whith the value "false"
P.S. (if it isn't clear)I try to make a function that when is called changes the value of this bool variable "byePointGiven" for a specific player
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
