![]() |
Blaze 3.9
|
Lifetime dependency on a singleton object. More...
#include <Dependency.h>
Public Member Functions | |
Constructors | |
Dependency () | |
Default constructor for Dependency. | |
Private Attributes | |
Member variables | |
std::shared_ptr< T > | dependency_ |
Handle to the lifetime dependency. | |
Lifetime dependency on a singleton object.
The Dependency template class represents a lifetime dependency on a singleton object based on the Blaze Singleton functionality. By use of the Dependency template, any class can by either public or non-public inheritance or composition define a single or multiple lifetime dependencies on one or several singletons, which guarantees that the singleton instance(s) will be destroyed after the dependent object. The following example demonstrates both the inheritance as well as the composition approach: