|
Boost : |
From: Peter Simons (simons_at_[hidden])
Date: 2005-07-18 05:09:35
Jason Hise writes:
> I am adding a policy to control exactly what happens if
> creation is attempted while the singleton instance
> exists. The options thus far include throwing an
> exception, doing nothing, or destroying and recreating
> the singleton, depending on the policy used.
Could you post some source code that illustrates what you
mean by "creating" an instance?
The usual approach to initializing static instances is
call_once() from Boost.Thread; so I am curious to know how
your approach compares to that.
> Does it make sense to have a similar policy for what
> happens when attempting to destroy an already destroyed
> instance?
A failed assertion would be my preferred way to handle this
condition; I don't see the need for a policy class.
Peter
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk