|
Boost : |
Subject: Re: [boost] [Boost.utility]
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-01-26 09:50:24
Andrew Chinkoff wrote:
>> 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
>
> Perhaps you're right. It is a matter of taste.
> But I like to write "Object::Instance().get()" rather than
> "global_object.get()".
One requires creating a new tailored object, the other adapts itself to
any object un-intrusively.
So it's pretty obvious global<int>.get() is better, and not just a
matter of taste.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk