
GMan-6 wrote:
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.
Hi, 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 me show //file 1 typedef boost::global<int> my_global_Int; //file 2 typedef boost::global<int> your_global_Int; my_global_int.get() is the same as your_global_Int.get() Vicente -- View this message in context: http://old.nabble.com/-Boost.utility--tp27309940p27325934.html Sent from the Boost - Dev mailing list archive at Nabble.com.