Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-08-07 14:57:04


--- In boost_at_y..., duncan_at_s... wrote:
> williamkempf_at_h... () wrote:
>
> > A singleton is a design pattern for a type with controlled
> > construction semantics, typically used to insure only
> > one instance may be created
>
> So what's the atypical usage? I always thought it was a design
pattern
> to ensure a type only has one instance and to provide a point of
access
> to that one instance.

From GoF, under Consequences, item 4: Permits a variable number of
instances. The pattern makes it easy to change your mind and allow
more than one instance of the Singleton class. Moreover, you can use
the same approach to control the number of instances that the
application uses. Only the operation that grants access to the
Singleton instance needs to change.

So, that's the atypical usage.

Bill Kempf


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