I use many CPtrList instances in my app, and for each one, I do something like this to cleanup:
CThing* pThing = (CThing*)m_pThings->RemoveHead();
m_pThingS = NULL;
I don't like writing the same thing over and over again, the only difference being the type of object contained.
Is there a way to write that code as a global utility funciton like : CleanupList(CPtrList* a_pList) or something to which I can simply pass the pointer to the CPtrList and cleanup as necessary w/o knowing the type of object? Or do I have to look at re-writing code using the CTypedPtrList that I recently became aware of?