I have 2 structures that point to each other
struct Person{
string name;
string born;
int age;
Id* p_id;
};
struct Id{
string id_number;
Person* p_person;
};
these structures are stored in two ponters vectors for those structures called vec_id and vec_person. I need a function that finds Person in vec_person and then removes the corresponding Id in the vec_id vector. My problem is converting p_id to a pointer.
example of my code:
std::vector<Person*> vec_person;
std::vector<Id*> vec_id;
vector <Person*>::iterator lowerb=std::lower_bound (vec_person.begin(), vec_person.end(), Peter, gt);
vec_id.erase((*lowerb)->p_id);
thanks for helping the guys
source
share