For the following code:
vector<int*> x; vector<int*>* p; // say I initiated x with a couple of integers p = &x; //erases the indicie of the given integer void erase(vector<int*> &x, int n){ int i = 0; while (*(x[i]) != n){ i++; } delete x[i]; x.erase(x.begin() + i); } If I call the code erase(*p, 2); I want to now set p to this address of this vector that has been erased ... I'm trying p = &(*p); .. but that doesn't work and I get a segmentation fault, any ideas?
p.erase.