Boost logo

Boost :

Subject: Re: [boost] [Boost.utility]
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-01-26 10:56:51

Stewart, Robert wrote:
> Jeff Flinn wrote:
>> That said, in my experience singletons are
>> generally used as a crutch to access global state.
> They do access global state, but there often is global state in an application. If Singletons provide the only means to access state, they formalize that access. Singletons can also, using policies, control lifetime, post-destruction behavior, etc. Consequently, Singletons are more than a crutch, though often overused, abused, or misused.

Well, I've yet to come across a case where global state couldn't have
been avoided by passing the appropriate objects by value or reference
along the function call chain.

Doing so avoids the mess that ensues when trying to unit test classes
and functions that use supposed singletons/global state.


Boost list run by bdawes at, gregod at, cpdaniel at, john at