Archived

This topic is now archived and is closed to further replies.

vectors and push_back

This topic is 5514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, lets say I have a vector vector<MyClass> myVec; When I call: myVec.push_back(Object); //assume Object is of type MyClass is Object passed by reference or is a copy of Object placed in the vector? digital radiation [edited by - +AA_970+ on November 6, 2002 3:01:58 PM] [edited by - Stoffel on November 6, 2002 4:24:19 PM]

Share this post


Link to post
Share on other sites
It places a copy of the object in the vector--it''s the only exception-safe way to do it. Overload your copy constructor to output a message and you will see it called when you push_back.

Share this post


Link to post
Share on other sites