CRBMap Class
This class represents a mapping structure, using a Red-Black binary tree.
template<
typename K,
typename V,
class KTraits = CElementTraits< K >,
class VTraits = CElementTraits< V >
> class CRBMap : public CRBTree< K, V, KTraits, VTraits >
Parameters
K
The key element type.V
The value element type.KTraits
The code used to copy or move key elements. See CElementTraits Class for more details.VTraits
The code used to copy or move value elements.
Members
Public Constructors
Name |
Description |
---|---|
The constructor. |
|
The destructor. |
Public Methods
Name |
Description |
---|---|
Call this method to look up keys or values in the CRBMap object. |
|
Call this method to remove an element from the CRBMap object, given the key. |
|
Call this method to insert an element pair into the map. |
Remarks
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.
Inheritance Hierarchy
CRBMap
Requirements
Header: atlcoll.h