Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

vectors and push_back

Started by +AA_970+ Nov 6, 2002 at 1:46 PM 3 replies 500+ views
Original Post
+AA_970+
+AA_970+
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]
mEmO
mEmO
It is placed in the vector
Stoffel
Stoffel
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.