c++ - Can a container of pointers be deep copied without explicity iterating over every element? -
this question nicely addresses deep copy of pointer (in case smart pointer type), , this question addresses deep copy of container loop.
is there way perform deep copy of container without explicitly iterating on every element?
for example, if have std::vector<std::shared_ptr<myobj>> original
, want copy entire container, duplicating each pointer new std::vector<std::shared_ptr<myobj>> copied
contains pointers copies of each of myobj
elements original
.
Comments
Post a Comment