CTypedPtrList

template< class BASE_CLASS, class TYPE >
class CTypedPtrList : public BASE_CLASS

Parameters

BASE_CLASS

Base class of the typed pointer list class; must be a pointer list class (CObList or CPtrList).

TYPE

Type of the elements stored in the base-class list.

Remarks

The CTypedPtrList class provides a type-safe “wrapper” for objects of class CPtrList. When you use CTypedPtrList rather than CObList or CPtrList, the C++ type-checking facility helps eliminate errors caused by mismatched pointer types.

In addition, the CTypedPtrList wrapper performs much of the casting that would be required if you used CObList or CPtrList.

Because all CTypedPtrList functions are inline, use of this template does not significantly affect the size or speed of your code.

Lists derived from CObList can be serialized, but those derived from CPtrList cannot.

When a CTypedPtrList object is deleted, or when its elements are removed, only the pointers are removed, not the entities they reference.

For more information on using CTypedPtrList, see the articles Collections and Collections: Template-Based Classes in Visual C++ Programmer’s Guide.

#include <afxtempl.h>

Class MembersHierarchy Chart

Sample   MFC Sample COLLECT

See Also   CPtrList, CObList