Matt Kerr
2003-10-25 09:25:03 UTC
This may seem trivial, but I'm having troubling finding a clear answer
through just searching on the net.
My question is:
In the following scenario where you are using STL stack or vector
container with a class object, ie:
stack<board> moves;
if you do something like:
moves.push( thismove );
Does thismove get copied or is it passed into the stack by reference?
In other words, if I am dynamically allocating thismove, should I be
worrying about deallocating (freeing) it at a later point? Or does pop()
call the deconstructor on the object for you?
Thank you!
through just searching on the net.
My question is:
In the following scenario where you are using STL stack or vector
container with a class object, ie:
stack<board> moves;
if you do something like:
moves.push( thismove );
Does thismove get copied or is it passed into the stack by reference?
In other words, if I am dynamically allocating thismove, should I be
worrying about deallocating (freeing) it at a later point? Or does pop()
call the deconstructor on the object for you?
Thank you!