Boost logo

Boost :

Subject: Re: [boost] [Boost.utility]
From: GMan (gmannickg_at_[hidden])
Date: 2010-01-25 14:36:17


Personally, I don't feel Boost needs a singleton utility. Singletons
themselves aren't *really* ever required. (When have you *actually* required
you *cannot* make more than one?) If you don't need more than one, don't
make more than one. A singleton takes this idea and forces you to mutilate
your class to fulfill some silly requirement.

Perhaps some boost::global<T> utility would be better, but a singleton
itself is bad practice, in my opinion. boost::global<T> would merely create
a global access point to T:

typedef boost::global<int> global_Int;
global_int.get() = 5; // getting the global int

It could have policies, to get the advantages of a singleton without the
unnecessarily intrusive nature of a singleton. Lazy initialization,
thread-safety, etc.

On Mon, Jan 25, 2010 at 10:25 AM, Andrew Chinkoff <achinkoff_at_[hidden]>wrote:

> Singleton.hpp have just corrected.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
GMan, Nick Gorski

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk