Re: Singleton pattern and destruction
From: Ulrich Eckhardt (doomster_at_knuut.de)
Date: 02/05/04
- Next message: ChrisJForeman: "Re: [C] simple string question"
- Previous message: Sumit Rajan: "Re: c++ cin question"
- In reply to: Erik Jälevik: "Singleton pattern and destruction"
- Next in thread: Erik Jälevik: "Re: Singleton pattern and destruction"
- Reply: Erik Jälevik: "Re: Singleton pattern and destruction"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Uli
-- Questions ? see C++-FAQ Lite: http://parashift.com/c++-faq-lite/ first !
- Next message: ChrisJForeman: "Re: [C] simple string question"
- Previous message: Sumit Rajan: "Re: c++ cin question"
- In reply to: Erik Jälevik: "Singleton pattern and destruction"
- Next in thread: Erik Jälevik: "Re: Singleton pattern and destruction"
- Reply: Erik Jälevik: "Re: Singleton pattern and destruction"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|