Template Class UDestroyer

Class Documentation

template<class T>
class UDestroyer

This class is used to delete a dynamically created objects. It was mainly designed to remove dynamically created Singleton. Created on the stack of a Singleton, when the application is finished, his destructor make sure that the Singleton is deleted.

Public Functions

inline UDestroyer(T *doomed = 0)

The constructor. Set the doomed object (take ownership of the object). The object is deleted when this object is deleted.

inline ~UDestroyer()
inline bool setDoomed(T *doomed)

Set the doomed object. If a doomed object is already set, the function returns false.

Parameters

doomed – the doomed object

Returns

false if an object is already set and the new object is not null, otherwise true