Is it necessary to clear all the inner lists to avoid a leak?:
class Instruction
{
int opcode;
int data1;
int data2;
bool Load(QTextStream* in);
void Save(QTextStream* out) const;
};
class Interpreter
{
QList<QList<Instruction>> steps;
bool Load(QTextStream* file)
{
if(file_is_bad)
{
return false;
}
int end = steps.size();
for(int i=0; i<end; i++)
{
steps.at(i).clear();
}
steps.clear();
//now that it's clear, rebuild it from file
return true;
}
};
Or can I just call steps.clear(); and call it a day?
(And here's some more text to get past the "too much code" error.)