2.4 Collection Classes

The Microsoft Foundation Class Library contains a number of ready-to-use lists, arrays, and maps that are referred to as “collection classes.” A collection is an extremely useful programming idiom for holding and processing groups of objects or standard types. C++ makes a collection appear as a single object, so collection member functions can operate on all elements of the collection.

All collections may be archived or sent to a dump context. The Dump and Serialize member functions for CObject pointer collections call the corresponding functions for each of their elements.

If you need a list, array, or map that is not included among the 16 standard collections provided with the Microsoft Foundation classes, then you can use the Templdef template tool that is included in the sample directory. The disk file MFC\DOC\TN004.TXT contains a guide to the use of this tool. The hierarchy chart of the Microsoft Foundation classes shown at the beginning of Part II indicates these three collection templates: “CArray<TYPE>,” “CList<TYPE>,” and “CMap<KEY, VALUE>.”