Having a vector containing pointers to objects then using the clear function doesn't call the destructors for the objects in the vector. I made a function to do this manually but I don't know how to make this a generic function for any kind of objects that might be in the vector.
void buttonVectorCleanup(vector<Button *> dVector){
Button* tmpClass;
for(int i = 0; i < (int)dVector.size(); i++){
tmpClass = dVector[i];
delete tmpClass;
}
}
This is the function I have that works fine for a specific type of object in the vector but I'd like a single function that could take any kind of vector with object pointers.