|
The Short and Dirty on Template Collections
===============================================================================
A Word From Microsoft:
The nontemplate collection classes have been provided by MFC beginning with MFC
version 1.0. If your code already uses these classes, you can continue to use
them. If you write new type-safe collection classes for your own data types,
consider using the newer template-based classes.
===============================================================================
Not referenced in this paper
Arrays
CArray CByteArray
CTypedPtrArray CDWordArray
CObArray CStringArray
CPtrArray CUintArray
CWordArray
Lists
CList CStringList
CTypedPtrList
CObList
CPtrList
Maps
CMap CMapWordToOb
CTypedPtrMap CMapStringToOb
CMapWordToPtr CMapStringToString
CMapPtrToWord
CMapPtrToPtr
CMapStringToPtr
===============================================================================
Collection contents Arrays Lists Maps
---------------------------- --------------- --------------- --------------
Collections of OBJECTS
of any type CArray CList CMap
Collections of POINTERS CTypedPtrArray CTypedPtrList CTypedPtrMap
to objects of any type
Must be one of the non-
template pointer collect-
ions predefined by MFC,
such as CPtrList or CPtrArray
===============================================================================
CArray
A non-unique array of simple types, objects or pointers.
CList
An ordered list of nonunique objects.
CMap
An ordered list of unique objects.
CTypedPtrArray
A type-safe �wrapper� for objects of class CPtrArray or CObArray.
CTypedPtrList
A type-safe �wrapper� for objects of class CPtrList or CObList.
CTypedPtrMap
A type-safe �wrapper� for objects of the pointer-map classes
CMapPtrToPtr, CMapPtrToWord, CMapWordToPtr, and CMapStringToPtr
===============================================================================
Insert Search for Duplicate
Shape Ordered? Indexed? an element specified element elements?
------ -------- -------- ---------- ----------------- ---------
List Yes No Fast Slow Yes
Array Yes By int Slow Slow Yes
Map No By key Fast Fast No (keys)
Yes (values)
Note: All collections can grow dynamically. Even arrays have SetAtGrow.
===============================================================================
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.