P
phiroc
Hi,
lets say that you create a vector and add an object to it, thus
v03.push_back(new Zone("1", 0, 2, line.substr(0,2), "xxx", "o"));
....
It is a good idea to delete the Zone objects added to the vector,
towards the end of the program, in order to release the memory, thus
for (itr = v03.begin(); itr != v03.end(); itr++) {
cout << "Nom: " << (*itr)->getNom().c_str() << endl;
....
delete *itr;
}
or does the vector's destructor automatically delete the Zones?
Many thanks.
phiroc
lets say that you create a vector and add an object to it, thus
v03.push_back(new Zone("1", 0, 2, line.substr(0,2), "xxx", "o"));
....
It is a good idea to delete the Zone objects added to the vector,
towards the end of the program, in order to release the memory, thus
for (itr = v03.begin(); itr != v03.end(); itr++) {
cout << "Nom: " << (*itr)->getNom().c_str() << endl;
....
delete *itr;
}
or does the vector's destructor automatically delete the Zones?
Many thanks.
phiroc