Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CSimpleMap Class
Collapse the table of content
Expand the table of content

CSimpleMap Class 

This class provides support for a simple mapping array.


template < 
   class TKey,
   class TVal,
   class TEqual = CSimpleMapEqualHelper< TKey, TVal > 
> 
class CSimpleMap

Parameters

TKey

The key element type.

TVal

The value element type.

TEqual

A trait object, defining the equality test for elements of type T.

CSimpleMap provides support for a simple mapping array of any given type T, managing an unordered array of key elements and their associated values.

The parameter TEqual provides a means of defining an equality function for two elements of type T. By creating a class similar to CSimpleMapEqualHelper, it is possible to alter the behavior of the equality test for any given array. For example, when dealing with an array of pointers, it may be useful to define the equality as depending on the values the pointers reference. The default implementation utilizes operator==().

Both CSimpleMap and CSimpleArray are provided for compatibility with previous ATL releases, and more complete and efficient collection implementations are provided by CAtlArray and CAtlMap.

Unlike other map collections in ATL and MFC, this class is implemented with a simple array, and lookup searches require a linear search. CAtlMap should be used when the array contains a large number of elements.

Header: atlsimpcoll.h

// Create a map with an integer key
// and character pointer value
      CSimpleArray<int, char *> iArray;

Community Additions

ADD
Show:
© 2015 Microsoft