Does one shared pointer assign another to free the memory managed by the latter? Let be
typedef shared_ptr<char> char_ptr_t; char_ptr_t pA(new char('A')); char_ptr_t pB(new char('B'));
Now, does the following statement free the memory 'A' ?
pA = pB;
Or I need to explicitly release it:
pA.reset(); pA = pB;
And, is the following code valid to achieve the same?
pA.reset(pB);
source share