binkle on Nostr: is there a term for a pointer class which keeps references to all the raw pointers to ...
is there a term for a pointer class which keeps references to all the raw pointers to it and then, upon deallocation, sets all those raw pointers to null? i.e.
MyPtr<int> pVal = new int;
int* pPtr1 = pVal;
int* pPtr2 = pVal;
// pVal now stores int**s pointing to pPtr1 and pPtr2
// do something with pPtr1 and pPtr2 (checking for nullptr as you naturally would)
delete pVal; // during operator delete, pPtr1 and pPtr2 are set to nullptr
MyPtr<int> pVal = new int;
int* pPtr1 = pVal;
int* pPtr2 = pVal;
// pVal now stores int**s pointing to pPtr1 and pPtr2
// do something with pPtr1 and pPtr2 (checking for nullptr as you naturally would)
delete pVal; // during operator delete, pPtr1 and pPtr2 are set to nullptr