How do you prevent people from instantiating Object (in your example)?
Also, I was more or less looking for a member-specific way of doing the singleton access. For example:
Object::instance()
On Wed, 05 Dec 2007 15:15:19 -0600, Robert Dailey wrote:Hi,
> Hi,
>
> I was wondering if the boost library had a class that I could derive my
> classes from to declare a singleton. For example:
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
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users