Creating Dynamic Singletons & the Loki Library
By Curtis Krauskopf, April 01, 2005
The Loki library is flexible enough to provide automatic deletion for most policies and provide automatic deletion for objects allocated with new that are not otherwise deleted by users.
April, 2005: Creating Dynamic Singletons & the Loki Library
Listing 5
template
<
class T,
template <class> class CreationPolicy,
template <class> class L,
template <class> class M
>
void SingletonHolder<T, CreationPolicy, L, M>::DestroySingleton()
{
assert(!destroyed_);
CreationPolicy<T>::Destroy(pInstance_);
pInstance_ = 0;
destroyed_ = true;
}