For each push_back() std::vector copies all the objects in a vector to a new one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For each push_back() std::vector copies all the objects in a vector to a new one?

I was practicing with constructors and stuff and noticed when I pushed back one of the objects of my class. So is it better to store the references or is there any way to stop the copying of existing objects.

25th Dec 2019, 9:36 AM
Akib
Akib - avatar
1 Answer
+ 1
Okay. Thanks ¯\(◉‿◉)/¯
25th Dec 2019, 10:52 AM
Akib
Akib - avatar