C++ In Theory: The Singleton Pattern, Part 2 (Page 1 of 4 )
In the previous article I introduced a design pattern named the “Singleton” as it is described in the book Design Patterns [Gamma]. Design patterns are very useful for describing solutions to common problems that software engineers often encounter. The Singleton pattern is a solution to the desire to have only one object of a class instantiated during the lifetime of your application.
Though design patterns were invented because solutions were often not reusable on the code level, the singleton pattern actually does have a reusable code version. We are going to look at a way to generalize the singleton implementation and how we can use the generalization to deal with construction/destruction sequence problems.