You don't have the same interrogation about your
s because you know that they have their own internal memory management.
Similarly the Standard C++ Library provides
with internal memory management.
If you used it instead of C arrays your question would look like:
.. let's assume that myStruct has a member which is
a pointer to an array of strings a vector of strings:
};Let's assume that I have
an array a vector of structures, where the size is determined dynamically:
std::vector<myStruct> MyStruct(structSize);Somewhere in the code I allocate a temporary
array vector of strings:
std::vector<std::string> TempList(listSize);and later in the code I assign that temporary
array vector to the instances of myStruct
MyStruct[i].MyList = TempList;
The question is how I should free the memory once I am done with the instances of myStruct.
The answer would be: You have nothing to do, all memory is deallocated in the objects destructors which are called when they get out of scope.