On Wed, Nov 20, 2002 at 01:42:47PM +0200, Yakov Bachmutsky wrote: > Hi, > > I've posted a proposal of a singleton library (among others) maybe a month > ago and as far as I remember it was ignored so I post it again with its name > as the subject, hoping this will help, and some explanations: > > 1. I use singleton<class T> to have a singleton instance of a class in my > apps. > The obvious advantage in developement of large apps is that u don't have to > remember the name of the 1 instance u create like g_myObj but only the > class's name and thus always use it like this: > singleton<myclass> p->method(); > > 2. In addition I use a singleton manager to have all singleton objects > started at app start: > singleton_manager::startup() > > 3. to use that I "register" classes to use the singleton class and manager > class using a macro: > REGISTER_SINGLETON(myclass) > > 4. classes can inherit the singleton class to get more specific behaviour > like two stage construction. > Every such inhariting class must have its own registration macro. > > 5. In addition to all the above I suggest few more little thingies to > support other singleton patterns, mostly in the form of macroes. There's > also an article on this topic: > http://www.beginthread.com/Article/yakov/Singleton Techniques/
I have done singleton stuff in a way many times. Could you please post some code examples. I'd like to have a look. Regards, Pavol _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost