Subject: Re: [boost] [Boost.utility]
From: Vicente Botet Escriba (vicente.botet_at_[hidden])
Date: 2010-01-26 11:53:09
> Personally, I don't feel Boost needs a singleton utility. Singletons
> themselves aren't *really* ever required. (When have you *actually*
> 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
> 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.
I don't like your global class as it could let you think you are working
with two different global variable when you are working with the same. Let
typedef boost::global<int> my_global_Int;
typedef boost::global<int> your_global_Int;
my_global_int.get() is the same as your_global_Int.get()
-- View this message in context: http://old.nabble.com/-Boost.utility--tp27309940p27325934.html Sent from the Boost - Dev mailing list archive at Nabble.com.