# Poco

# template < class S >

# class SingletonHolder

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

## Description

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

## Constructors

### SingletonHolder

SingletonHolder();

Creates the SingletonHolder.

## Destructor

### ~SingletonHolder

~SingletonHolder();

Destroys the SingletonHolder and the singleton object that it holds.

## Member Functions

### get

S * get();

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

### reset

void reset();

Deletes the singleton object.