On Wed, 05 Dec 2007 15:15:19 -0600, Robert Dailey wrote:
Hi,
I was wondering if the boost library had a class that I could derive my classes from to declare a singleton. For example:
Hi, At the bottom of http://uint32t.blogspot.com/2007/12/you-lazy-bastard-part-1.html there is a simple class that I've used. The usage would look something like: struct Object {...}; // returns Object &, lazily-initialized and threadsafe singleton<Object>::instance(); It requires Boost Threads to be threadsafe. I apologize in advance for the language, but didn't think it could possibly be useful :-) I also recently came to know that there is something in the Boost Vault under the X-files folder. Let me know if you have any questions. -- Sohail Somani http://uint32t.blogspot.com