How does std::vector's copy constructor operate?

前端 未结 1 1764
醉酒成梦
醉酒成梦 2021-02-07 10:44

How does a std::vector initialize its self when the following code is invoked

std::vector original;
std::vecto         


        
相关标签:
1条回答
  • 2021-02-07 11:22

    std::vector and most other standard library containers store elements by value. The elements are copied on insertion or when the container is copied. std::string also maintains its own copy of the data, as far as your usage of it is concerned.

    0 讨论(0)
提交回复
热议问题