STL vector
Hi,
Quick C++ STL question: I'm using a vector container of a class I've written; since it uses dynamic memory, does the vector container need it to have a copy constructor and/or assignment operator for the erase method? I get around the problem for adding objects to it by having explicit load and unload functions that I call after using methods such as push_back, but I'm worried that internally the vector may be copying or assigning objects for erase.
Can anyone clarify this?
Cheers,
Nick
[edit] clarifications
[Edited by - Silex on December 3, 2005 6:52:25 PM]
Then try asking your question again. As far as I can tell you're only asking whether or not your class needs to have the copy constructor and assignment operator.
erase() will call the assignment operator if you don't erase only elements at the end. If any elements are left between the erased elements and the end of the vector, they will have the assignment operator called.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement