Hi friends.
I am leaning towards using std::tr1::shared_ptr to automatically manage a pointer to a utility class in my GUI program.
Basically here's a skeleton of the program:
int main () {
Allocate dynamic memory for utility class
GUI code.. GUI code... GUI Code..
GUI Main Loop
}
The program finishes when the user calls a quit_cb or if SIGINT (CTRL+C) is called. In my situation, I need to be able to call delete in either case. I can call delete in quit_cb but if SIGINT is called ... then delete is never called! Is it appropriate to use a smart pointer in this case?