This documentation is archived and is not being maintained.

CRBMap Class

This class represents a mapping structure, using a Red-Black binary tree.

   typename K, 
   typename V, 
   class KTraits = CElementTraits< K >, 
   class VTraits = CElementTraits< V >  
> class CRBMap : public CRBTree< K, V, KTraits, VTraits >


The key element type.


The value element type.


The code used to copy or move key elements. See CElementTraits Class for more details.


The code used to copy or move value elements.

CRBMap provides support for a mapping array of any given type, managing an ordered array of key elements and their associated values. Each key can have only one associated value. Elements (consisting of a key and a value) are stored in a binary tree structure, using the CRBMap::SetAt method. Elements can be removed using the CRBMap::RemoveKey method, which deletes the element with the given key value.

Traversing the tree is made possible with methods such as CRBTree::GetHeadPosition, CRBTree::GetNext, and CRBTree::GetNextValue.

The KTraits and VTraits parameters are traits classes that contain any supplemental code needed to copy or move elements.

CRBMap is derived from CRBTree, which implements a binary tree using the Red-Black algorithm. CRBMultiMap is a variation that allows multiple values for each key. It too is derived from CRBTree, and so shares many features with CRBMap.

An alternative to both CRBMap and CRBMultiMap is offered by the CAtlMap class. When only a small number of elements needs to be stored, consider using the CSimpleMap class instead.

For a more complete discussion of the various collection classes and their features and performance characteristics, see ATL Collection Classes.

Header: atlcoll.h