MFC Collection Class. CArray, CList, CMap, ...
The easiest way to implement a type-safe collection that contains objects of any type is to use one of the MFC template-based classes. For examples of these classes, see the MFC sample COLLECT.
The following table lists the MFC template-based collection classes.
Collection Template Classes
Collection contents | Arrays | Lists | Maps |
---|---|---|---|
Collections of objects of any type | CArray | CList | CMap |
Collections of pointers to objects of any type | CTypedPtrArray | CTypedPtrList | CTypedPtrMap |
If your application already uses MFC nontemplate classes, you can continue to use them. However, for new collections, we recommend that you use the template-based classes. The following table lists the MFC collection classes that are not based on templates.
Nontemplate Collection Classes
Arrays | Lists | Maps |
---|---|---|
CObArray | CObList | CMapPtrToWord |
CByteArray | CPtrList | CMapPtrToPtr |
CDWordArray | CStringList | CMapStringToOb |
CPtrArray |
| CMapStringToPtr |
CStringArray |
| CMapStringToString |
CWordArray |
| CMapWordToOb |
CUIntArray |
| CMapWordToPtr |
///531,