Controlling the destruction order of Singleton objects

Abstract The Singleton pattern [1] is a solution to (some of) the drawbacks of using global variables. Among its advantages is that the instance is always created prior to being referenced (this effectively solves the problem of initialization order when several interdependent instances are involved). This article examines some of the existing Singleton realizations in C++ and their drawbacks, and presents a solution to the complement problem, namely, the destruction order of global instances. To this end, I propose to use a Destruction Manager, so that all the singleton objects register with it, specifying interdependencies between them. Following [2], the Destruction Manager is analyzed as a composite design pattern.