I have a function that is to remove an object from a list based on it's name, which is returned through the class function special_event.getName(). It takes the list and the name of the object it is to remove, and after removing it, it is to return the list with the object removed. Here is the code:
list<special_event> removeEvent(string eventName, list<special_event> events)
{
list<special_event>::iterator eit;
string getName;
for (eit = events.begin(); eit != events.end(); eit++)
{
if ((*eit).getName() == eventName)
{
events.remove(*eit);
}
}
cout << endl << endl << eventName << " has been removed!";
return events;
}
I get the error "error C2678: binary '==' : no operator found which takes a left-hand operand of type 'special_event' (or there is no acceptable conversion).
Any help would be appreciated, thanks