
On Tue, 11 Jan 2005 22:30:42 +0530 "Mithun R K" <mithun.radhakrishnan@hp.com> wrote:
1. Have a single SingletonRegistry that would keep pointers to all Singleton instances (well, actually, SingletonBase instances. SingletonBase is not a class-template.)
Sorry for interloping here, but I think boost already provides several mechinisms for doing the same thing without requiring the inheritance hierarchy. For example, you could register boost::function<> objects to create/destroy, or you could require registry as boost::shared_ptr< Whatever >, and store boost::shared_ptr< void >, which already knows how to properly destroy itself, or ... I have not thought too much about your other issues, but you may want to take a look at ACE, and the ACE_Object_Manager (or something like that). It manages objects, and I believe it hooks atexit() to do other destructions. Of course, there are pros/cons to this approach as well, but it is there to look at...