Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2007-12-05 16:35:35


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 Dec 5, 2007 3:26 PM, Sohail Somani <sohail_at_[hidden]> wrote:

> 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
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net