Suppose I have a vector as such
std::vector<float*> vec;
Now I know that I need to delete the pointers inside the vector to reclaim memory. The way I know is by iterating through the vector and deleting each pointer. I wanted to know if there was a faster way of accomplishing this.
I have the following scenario
std::vector<float*> cont;
for(int i=0; i < SelectedColumns.size();i++)
{
if(someList.count()>0)
{
float *a = new float( column_cell_mapper[SelectedColumns[i]]->text().toFloat());
cont.push_back(a);
someclass.somemethod(*a) // Requires a reference
....
....
}
}
someclass.process();