How can I determine if a C++ object has been deallocated?
<p>I have a <a href="http://stackoverflow.com/questions/1373686/unable-to-catch-c-exception-using-catch">previous question</a> that was answered in which I describe difficulties catching an exception when I try to access an object that has been deallocated by a third-party function.  The function sometimes does and sometimes doesn't deallocate the object.  </p>

<p>In order to avoid having to use a try/catch block to catch the SEH Exception as described in the previous question, I need to be able to tell whether the object has been deallocated or not.  </p>

<p>How can I determine if a C++ object has been deallocated or is still a valid pointer?</p>
