I have made a mapping between string
and a class type Person
as mentioned in my earlier question using the following code.
std::map<std::string, Person*> person_list;
// while...
Person* person = University::addInput(person_type, person_name); //person_type: EMPLOYEE, ALUMNI, STUDENT
person_list[person_name] = person;
Problem: If the Person type
is ALUMNI
then it should be connected with another person of type STUDENT
who's name has already been mapped before. Now, i want to connect these two persons.
I am trying to find the student_name
(which is a key in this mapping scheme) but don't understand the correct way to do so.
PS: To remove the unnecessary confusion,i removed the find()
problem. My real task is to find the mapped object at given key. So, i thought that find() could help me. But if there is some other method..please suggest me