C++: Delete a struct?
- by Rosarch
I have a struct that contains pointers:
struct foo
{
char* f;
int* d;
wchar* m;
}
I have a vector of shared pointers to these structs:
vector<shared_ptr<foo>> vec;
vec is allocated on the stack. When it passes out of scope at the end of the method, its destructor will be called. (Right?) That will in turn call the destructor of each element in the vector. (Right?) Does calling delete foo delete just the pointers such as foo.f, or does it actually free the memory from the heap?