Boost logo

Boost :

From: CHAOS (0xchaos_at_[hidden])
Date: 2005-01-05 04:32:50


This post refers to the following code:
http://www.ezequal.com/chaos/libs/singleton.h

I have developed a templated singleton class which enforces almost
every rule of the singleton pattern at compile time. This library
provides a very clean, flexible format for client code to implement
its own singleton classes which may have dependencies on each other.
I have three questions.

Does it make any sense to use a template allocator parameter, like the
standard container types, to control creation and destruction of my
instance, or are new and delete sufficient?

Is there any other functionality that should be added? Specifically,
is it sufficient to enforce that singletons are created in a specific
order before main and destroyed in the reverse order after main (using
dependency instances), or should I provide some way to support
alternate lifetimes (ex: create on first reference to instance)?

Is there any interest in adding this library to Boost?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk