In this chapter, we have learned pretty much all there is to know about the singleton, which is a classic object-oriented programming pattern. We have discussed when to consider using the singleton pattern, and when it should be avoided as a sign of a sloppy design. We have considered several possible implementations of the singleton: some are lazily initialized on demand, and others are eagerly initialized up front; some use multiple handle objects that are all equivalent, and others explicitly present the programmer with the single object. We have considered and compared the thread-safety and performance issues with the different implementations and reviewed the potential issues with the order of construction and destruction.
With so many different implementations, the reader can be forgiven for wanting a more definitive recommendation—which singleton should I...