In C++ How to decide or know if a pointer was deleted before??
when i tried to delete a pointer that was previously deleted in another part of the code it threw an exception that can't be handled.
I was wondering if there is a way to check or try delete the pointer ? any reference about advanced memory operations.
also i want to master the un-handled exceptions of pointers and the access to protected or access is violation ,... this kind of error.
thanks for those who give some of their knowledge and their time to help other people and share their benfits
Update
The big advice from a lot of modern c++ developers community is - Use smart pointers or try to avoid the use of raw pointers. But for throw security and insuring free of memory (ISO_CPP_FAQ) and of course if you want to avoid the small overhead of using smart pointers[may not be noticeable always but they have overhead] you can write your custom methods that deal with raw pointers [type*] - this is not general.
Prefer always smart pointers to raw pointers.
In 'Going Native 2013' a common advice given was - Never use raw pointers.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…