I am passing a vector pointer to another function which pushes data using that pointer:
void foo(vector<pair<int,int>> * vp){
vp->push_back(pair<int,int>(1,1)); //causes segfault
}
void bar(vector<pair<int,int>> *vp = NULL){
foo(vp);
}
The push_back causes segfault.
If it hurts, don’t do it. You should almost never pass things like vectors using pointers – use references instead: