Here is a sample code that I have:
void test() { Object1 *obj = new Object1(); . . . delete obj; }
I run it in Visual Studio, an
saveLeaves(vec,msh); I'm assuming takes the msh pointer and puts it inside of vec. Since msh is just a pointer to the memory, if you delete it, it will also get deleted inside of the vector.
saveLeaves(vec,msh);
msh
vec