Exporter (0) Imprimer
Développer tout

CMap::GetSize

Returns the number of map elements.


INT_PTR GetSize( ) const;

The number of items in the map.

Call this method to retrieve the number of elements in the map.

CMap<int,int,CPoint,CPoint> myMap;
   int i;

   myMap.InitHashTable( 257 );

   // Add 10 elements to the map.
   for (i=0;i < 200;i++)
      myMap[i] = CPoint(i, i);

   // Remove the elements with even key values.
   CPoint pt;
   for (i=0; myMap.Lookup( i, pt ) ;i+=2)
   {
      myMap.RemoveKey( i );
   }
#ifdef _DEBUG
   ASSERT(myMap.GetSize() == 100);
    afxDump.SetDepth( 1 );
    afxDump << "myMap: " << &myMap << "\n";
#endif

Ajouts de la communauté

AJOUTER
Afficher:
© 2014 Microsoft