In C++, an object is destroyed when it exits scope. If I create an object within a handler, and that the scope for that handler exits, is the object destroyed? Is there a secret “destructor” handler that I could implement on object destruction?
Specifically, I want to create an object that I can create within a handler, which will set my search rectangle, and when the handler exits (for whatever reason) the search rectangle is restored to its previous state. Can this be done?