Re: Singleton pattern and destruction
From: Ulrich Eckhardt (doomster_at_knuut.de)
Date: Thu, 05 Feb 2004 22:03:02 +0100
Erik Jï¿½evik wrote:
> However, the auto_ptr needs access to the singleton's destructor in
> order to call delete on it. But, since it's a singleton, I want the
> destructor to be protected so that no other class can call it.
> Any suggestions on how to to get around this?
Make auto_ptr<your_class> a friend?
There's other ways, too, using e.g. boost::shared_ptr<> with a custom
deleter or things like that.
-- Questions ? see C++-FAQ Lite: http://parashift.com/c++-faq-lite/ first !