I am trying to find within a container whether or not an object of certain attributes exists.
I thought i could use the count member function of the multiset container but it is not working.
I need to only match by the second and third parameters in the actor objects that are stored in the all_actors container. Within the actors class, I have overloaded the comparitor '==' to reflect that these are the 2 parameters that justify the objects to be the same as one another.
friend bool operator == (const actor& a1, const actor& a2)
sition) && (a1.type==a2.type))?true:f
alse; // Overload the comparator operator
Shouldnt the member function know that with my overloaded operator in the actor class - that I want to compare second and third parameter? Surely i dont need to match ALL the attributes for the count member function to count it?
bool find_curr_actor(string str1, string str2, string str3) // Function to find the current actor object and point the member iterator
// to this actor object.
actor *search_actor; // Create a temporary pointer to actor with which to perform the search.
search_actor= new actor(0,str1,str2,str3); // Assign a new actor with the search properties and a reference ID of 0.
if (count==0) // If the actor wasnt found in the set then say so
cout<<endl<<"Actor Position "<< search_actor->getposition()
<<" and Type:"<<search_actor->gettype()<<" not found";
delete search_actor; // Delete the search object