共用方式為


CTypedPtrMap Class

Provides a type-safe "wrapper" for objects of the pointer-map classes CMapPtrToPtr, CMapPtrToWord, CMapWordToPtr, and CMapStringToPtr.

template< class BASE_CLASS, class KEY, class VALUE >
class CTypedPtrMap : public BASE_CLASS

Parameters

  • BASE_CLASS
    Base class of the typed pointer map class; must be a pointer map class (CMapPtrToPtr, CMapPtrToWord, CMapWordToPtr, or CMapStringToPtr).

  • KEY
    Class of the object used as the key to the map.

  • VALUE
    Class of the object stored in the map.

Members

Public Methods

Name

Description

CTypedPtrMap::GetNextAssoc

Gets the next element for iterating.

CTypedPtrMap::Lookup

Returns a KEY based on a VALUE.

CTypedPtrMap::RemoveKey

Removes an element specified by a key.

CTypedPtrMap::SetAt

Inserts an element into the map; replaces an existing element if a matching key is found.

Public Operators

Name

Description

CTypedPtrMap::operator [ ]

Inserts an element into the map.

Remarks

When you use CTypedPtrMap, the C++ type-checking facility helps eliminate errors caused by mismatched pointer types.

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

For more information on using CTypedPtrMap, see the articles Collections and Template-Based Classes.

Inheritance Hierarchy

BASE_CLASS

CTypedPtrMap

Requirements

Header: afxtempl.h

See Also

Reference

Hierarchy Chart

CMapPtrToPtr Class

CMapPtrToWord Class

CMapWordToPtr Class

CMapStringToPtr Class

Concepts

MFC Sample COLLECT