Click here to Skip to main content
Licence CPOL
First Posted 22 Nov 1999
Views 55,114
Bookmarked 32 times

Smart List classes

By | 5 Apr 2000 | Article
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    About the Author

    Simon Hughes

    Software Developer (Senior)
    www.ByBox.com
    United Kingdom United Kingdom

    Member

    C++ and C# Developer for 21 years. Microsoft Certified.
     
    UK Senior software developer / team leader.
     
    I've been writing software since 1985. I pride myself on designing and creating software that is first class. That means it has to be fast, scalable, and with good use of design patterns.
     
    I have done everything from risk analysis and explosion modelling, banking systems, to highly scalable multi-threaded arrival and departure screens in many leading airports, to state of the art wireless warehouse systems.

    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board. (secure sign-in)
     
    Search this forum  
     FAQ
        Noise  Layout  Per page   
      Refresh
    GeneralCMyObList error Pinmembermirano23:32 22 Feb '06  
    GeneralCumulating when serialization Lists of Lists PinsussAndreas Müller22:01 30 Mar '00  
    GeneralRe: Cumulating when serialization Lists of Lists PinsussSimon Hughes5:29 31 Mar '00  

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Mobile
    Web01 | 2.5.120517.1 | Last Updated 6 Apr 2000
    Article Copyright 1999 by Simon Hughes
    Everything else Copyright © CodeProject, 1999-2012
    Terms of Use
    Layout: fixed | fluid