By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,663 Members | 762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,663 IT Pros & Developers. It's quick & easy.

Linked List used in MFC

xarzu
P: 68
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?
Aug 15 '07 #1
Share this Question
Share on Google+
1 Reply


Banfa
Expert Mod 5K+
P: 8,916
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.
Aug 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.