Boost logo

Boost :

Subject: Re: [boost] [Boost.utility]
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2010-01-26 16:41:21

Jeff Flinn wrote:
> I've always been mystified as to why a singleton instance is accessed
> via pointer rather than by reference. Singleton models a
> one-and-only-one relationship a pointer models a zero-or-one
> relationship. That said, in my experience singletons are generally
> used as a crutch to access global state.
I use them in a game to access part of the global state from a different
part. For example, the part that does random numbers keeps state, and
for various reasons, given a particular seed must be deterministic, so
there can be only one. It's single threaded though. I store an
instance as a pointer, but return it from the singlecrutch <grin;> as


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