[Dev-C++] STL stack/vector pushing class objects
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Matt K. <sy...@as...> - 2003-10-25 11:24:11
|
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! |