Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Smart List classes

0.00/5 (No votes)
5 Apr 2000 1  
Wrapper classes for MFC list classes the extend their functionality
  • Download source - 3 Kb

    Introduction

    This article presents a number of list classes that encapsulate the MFC list classes. This code is in use in production code and has been fully tested. But, should any users out there find any bugs or improvements, please send them to me.

    The code is absolutely free and can be used as you see fit, but just leave my e-mail address in the code. Enjoy.

    The classes

    There are two template classes and one normal class defined here.

    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 properly (important for schema versioning).

    CMyTypedPtrList (template)

    This class is a wrapper for the CTypedPtrList MFC template class. The items pointed to will be properly deleted thus causing no memory leaks. Use the list just like you would a CObList. For example...
    CMyTypedPtrList<CYourItem> list1(true);
    list1.AddHead(new CYourItem());
    list1.RemoveAll(); // no memory leak!
    

    CMyObList

    This class is a wrapper for the CObList MFC class. The items pointed to will be properly deleted thus causing no memory leaks.

    Updated

    This article was updated April 6, 2000 to include the updates as detailed by Andreas Müller.

  • License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here