What is the best way to make and use a linked list for MFC? Is it better to use one of the MFC classes? If so, which one? Or is it better to use a standard template library class and if so, which one?
Linked List used in MFC
Collapse
X
-
If you are not going to be serialising the list then I would use an STL class. Conventional wisdom with the STL is to use a vector unless you have a good reason not to.
Good reasons may be that you want to do a lot of inserts or deletes at the begining or in the middle of the list which has a fair bit of overhead in a vector. In which case you could use a list. Or that you need efficient random access by key, in which case a map may be more appropriate. Or that the object is the key in which case a set may be more appropriate.
If you are going to be serialising the data in the list then use an MFC class because they support the MFC serialisation mechanism. a CList or possibly a CTypedPtrList.
Comment