P
Pushkar Pradhan
I have a function which holds a list of my data structure PARTICLE,
initially the list is declared empty, but I grow it in this function.
Now my question is do I have to write a destructor (since the datatype
is my own) to delete the list?
Or does it get deleted automatically once the function exits?
Code:
compute_hull(....)
{
list<PARTICLE> hull2;
for(i = 0; i < X; i++) {
/* depending on some condition */
hull2.push_back(...);
}
/* is destructor reqd. for hull2 now? */
}
Thanks,
Pushkar Pradhan
initially the list is declared empty, but I grow it in this function.
Now my question is do I have to write a destructor (since the datatype
is my own) to delete the list?
Or does it get deleted automatically once the function exits?
Code:
compute_hull(....)
{
list<PARTICLE> hull2;
for(i = 0; i < X; i++) {
/* depending on some condition */
hull2.push_back(...);
}
/* is destructor reqd. for hull2 now? */
}
Thanks,
Pushkar Pradhan