template < class S >

class SingletonHolder

Library: Foundation
Package: Core
Header: Poco/SingletonHolder.h


This is a helper template class for managing singleton objects allocated on the heap. The class ensures proper deletion (including calling of the destructor) of singleton objects when the application that created them terminates.

Member Summary

Member Functions: get, reset


SingletonHolder inline


Creates the SingletonHolder.


~SingletonHolder inline


Destroys the SingletonHolder and the singleton object that it holds.

Member Functions

get inline

S * get();

Returns a pointer to the singleton object hold by the SingletonHolder. The first call to get will create the singleton.

reset inline

void reset();

Deletes the singleton object.