18.5 Shared Objects and Reference Counting 803
static stdext::hash_map<unsigned int,Object*>* InUse;
static void PrintInUse (const char* acFilename,
const char* acMessage);
private:
int m_iReferences;
The static hash map keeps track of objects currently in the system. The hash map is
initially empty at program execution time. At program termination, if the hash map
is not empty, the contents may be printed to a file using the
PrintInUset function.
This is useful for tracking object leaks and for letting the application writer know
that he did not release all the objects he should have.
The smart pointer system is built on top of this system and uses templates:
template <class T> class Pointer
{
public:
// construction and destruction
Pointer (T* pkObject