Here are two template classes and one normal class designed
to prevent memory leaks.
CMyList (template)
This class is a wrapper for the CList MFC template class. It adds
extra functionality and allows its member items to serialise
themselves (important for schema versioning).
CMyTypedPtrList (template) my personal favourate
This class is a wrapper for the CTypedPtrList MFC template class.
The items pointed to will be properly deleted thus causing no memory
leaks.
CMyObList (standard class)
This class is a wrapper for the CObList MFC class.
The items pointed to will be properly deleted thus causing no memory
leaks.
Downloads
Download demo project – 9 Kb
Download source – 3 Kb
History