|
Boost : |
Subject: Re: [boost] Request for Feedback on the Singularity Design Pattern
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2011-06-28 05:34:47
On Tue, Jun 28, 2011 at 07:13, Ben Robinson <icaretaker_at_[hidden]> wrote:
> The source is now available on GitHub at:
>
> https://github.com/icaretaker/Singularity
>
I started to read it and I have a minor suggestion : would it be a good idea
to also allow creation/destruction of the object without using create() and
destroy()?
class TheObject : public singularity<TheObject, global_access > {...}
m_the_object = new TheObject();
...
// in another module
auto& the_object = TheObject::get(); // ok if run after the previous code
...
// in another function
delete m_the_object; // now TheObject::get() will throw
I've seen such possibility in Singleton implementations and found it useful
but I'm not sure if it's a good idea because of the destruction function
throwing.
Joël Lamotte
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk