Is std::vector copying the objects with a push_back?

后端 未结 8 1725
夕颜
夕颜 2020-11-28 00:46

After a lot of investigations with valgrind, I\'ve made the conclusion that std::vector makes a copy of an object you want to push_back.

Is that really true ? A vect

8条回答
  •  独厮守ぢ
    2020-11-28 01:44

    if you want not the copies; then the best way is to use a pointer vector(or another structure that serves for the same goal). if you want the copies; use directly push_back(). you dont have any other choice.

提交回复
热议问题