共用方式為


CRBMultiMap::CRBMultiMap

建構函式。

explicit CRBMultiMap(
   size_t nBlockSize = 10 
) throw( );

參數

  • nBlockSize
    區塊大小。

備註

如果需要, nBlockSize 參數是數量的測量記憶體配置新的項目。 較大的區塊大小讓呼叫減少記憶體配置常式,不過,使用更多資源。 預設一次要配置 10 個元素的空間。

提供基底類別 CRBTree 參閱的文件。如需可用的其他方法的詳細資訊。

範例

// Define a multimap object which has an integer
// key, a double value, and a block size of 5
CRBMultiMap<int, double> myMap(5);

// Add some key/values. Notice how three
// different values are associated with 
// one key. In a CRBMap object, the values
// would simply overwrite each other.
myMap.Insert(0, 1.1);
myMap.Insert(0, 1.2);
myMap.Insert(0, 1.3);
myMap.Insert(1, 2.1);

// Look up a key and iterate through
// all associated values

double v;
POSITION myPos = myMap.FindFirstWithKey(0);

while (myPos != NULL)
{
   v = myMap.GetNextValueWithKey(myPos,0);
   // As the loop iterates, v 
   // contains the values 1.3, 1.2, 1.1
}

// Remove all of the values associated with that key
size_t i = myMap.RemoveKey(0);

// Confirm all three values were deleted
ATLASSERT(i == 3);

需求

Header: atlcoll.h

請參閱

參考

CRBMultiMap 類別

CRBMultiMap::~CRBMultiMap