If I have a function
struct myStruct{
double myDouble;
}
func(vector <myStruct> &myVector){
myStruct dynamicMyStruct;
dynamicMyStruct = new myStruct;
myVector.push_back(dynamicMyStruct);
}
how do I delete the memory associatted with dynamicMyStruct? I cannot delete it at the end of the function since I still need the contents of the vector after the function returns...
Thanks!
struct myStruct{
double myDouble;
}
func(vector <myStruct> &myVector){
myStruct dynamicMyStruct;
dynamicMyStruct = new myStruct;
myVector.push_back(dynamicMyStruct);
}
how do I delete the memory associatted with dynamicMyStruct? I cannot delete it at the end of the function since I still need the contents of the vector after the function returns...
Thanks!