Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-01 16:32:07


"E. Gladyshev" <egladysh_at_[hidden]> writes:

> --- David Abrahams <dave_at_[hidden]> wrote:
> [...]
>> Yes, this problem is mostly a quirk of global state, but can be
>> realized in any system with side-effects, and almost never comes up in
>> (my) practice.
>>
>
> I would not be so sure about "almost never".
> People use singletons quite often. It is one of
> the design patterns in Gof.
> It seems that basic guarantees concept for
> singletons is very problematic.

It's not a problem of the basic guarantee, but of invariants and
global state (totally apart from exception handling issues). The best
thing you can do to avoid this problem is to make your global
singletons const.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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