I have a class PythonFunction that contains private vector filled with class PythonArgument values
there is a destructor in PythonArgument that does clean up my pointers, however I'll often need to change the values of that vector (the one from PythonFunction containing PythonArgument values) using function int removeAllArguments();
is it enough to do something like this
1 2 3 4 5 6 7 8 9
int PythonFunction::removeAllArguments()
{
unsigned size = args.size();
//here will be several PythonArgument class values, these need to be cleaned up properly using destructor (or clean function)
args.clear();
returnint(size - args.size());
}
or do I need to go thru every value in vector "args" and call a destructor for every value (for every PythonArgument) it contains? something like this:
1 2 3 4 5 6 7 8 9 10 11
int PythonFunction::removeAllArguments()
{
unsigned size = args.size();
for(unsigned i = size; i >= 0; i--)
args[i].clean();
args.clear();
returnint(size - args.size());
}
what I basically want to know is whether using vector::clear() does call the class destructor of the class that's within the vector, when it destroys the values in itself, or do I have to do that on my own before removing them from the vector?