After I performed some operations on the vector of structs, I need to free the memory. I suppose clear() will not be sufficient, but I'm not sure how to perform individual delete.
typedef std::vector<VertexRAM> VecVertexRAM; // definition of a vector of structs
template <typename type>
void freeFromMemory(std::vector<type>& myVec) {
typename std::vector<type>::iterator myIter=myVec.begin();
while(myIter!=myVec.end()) {
delete(*myIter);
++myIter;
}
myVec.clear();
}
This outputs the following error:
Code:
error: type ‘struct VertexRAM’ argument given to ‘delete’, expected pointer
Any ideas on how to do this? Thanks