From: Jason Hise (chaos_at_[hidden])
Date: 2005-02-12 11:59:20
I would like to get general feedback on a feature that has been
requested. Some background:
Right now, my singleton pointer classes serve a variety of purposes. In
the first place, they are the access mechanism for a singleton. Any
pointer constructed immediately points to the singleton instance (or
possibly null if the instance hasn't been created yet). If the
singleton uses instant_creation, the first pointer created creates the
singleton instance. When a member is accessed through a singleton
pointer, an intermediate pointer type performs locking, and if
lazy_creation is set it may also create the singleton instance.
Regardless of the lifetime mechanism used, when the singleton instance
gets destroyed all pointers instantly reflect this by becoming null.
It has been suggested that I provide a mechanism to get a bald pointer
to the instance, such as an unsafe_ptr member function of either the
pointer class or the singleton itself. I feel that such a mechanism
would be very dangerous, because the bald pointer could not perform lazy
creation, it would not lock the operations, and it would not reflect
when the singleton is destroyed.
Are there instances in which allowing bald pointers to exist is
necessary and/or useful?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk