If you have such structure then returning b might cause a problem in itself unrelated to memory consuption. You are probably returning a pointer to a local object. Of course it depends on where "a" gets its values from...
You don't have to (and even shouldn't) delete "a" but you might have to delete its contents. (for(int i=0;i<a.size();i++) delete a[i]; or qDeleteAll(a)How do I properly delete a? Or don't I have to?
"private" to what scope? Some object or is it a global variable?In ClassC.h there is a private variable declared like:
PClass *c;
I'm... not sure what it is supposed to doIs this the right way to resolve this?
Vectors clear themselves upon destruction but they only destruct objects they carry, so if you have a vector of pointers, only pointers will get 'destroyed', not the objects behind them. In that case you have to call qDeleteAll() on each vector (calling clear() is not enough because of the same reason).Also Both Classes B and A have an extensive ammount of QVectors... Should I destroy (using QVector::clear() command) all the vectors in the Classe's Destructor?
Bookmarks