For example:
#include <memory>
shared_ptr<map<int, int>> ptr1 = make_shared<map<int, int>>();
map<int, int>::const_iterator iter = ptr1->begin();
shared_ptr<map<int, int>> ptr2 = make_shared<map<int, int>>();
ptr1 = ptr2;
My question: Could the iter add the counts of ptr1? In this case, will the ptr1's memory address free?
Aucun commentaire:
Enregistrer un commentaire