Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. void DummyMethod(void)
  2. {
  3.     Map<char, int> _map; //The first element is the key and the second is the Value
  4.                  //Keys must be unique like primary keys in databases
  5.  
  6.     _map.Insert(MapEntry<char, int>('a', 55));//Inset our first entry
  7.     _map.Insert(MapEntry<char, int>('b', 22));//Inset our second entry
  8.     _map.Insert(MapEntry<char, int>('c', 22));//Inset our third entry
  9.     _map.Insert(MapEntry<char, int>('b', 11));//Wait we have already got an entry
  10.                           //with this key so it will not get added
  11.  
  12.     //Ideally what you would so is check if a key exists first
  13.     //If the key exists it will return its position,
  14.     //however if the key does not it will return -1
  15.     int valueA = _map.FindKey('b');//This will return 1 as 'b' exists
  16.     int valueF = _map.FindKey('f');//This will return -1 as 'f' does not exist
  17.  
  18.     unsigned int count = _map.Count();
  19.     FOR_EACH_MAP(_map, count, c) //This Macro will iterate through each element in order
  20.     {
  21.         printf("First-[%c] Second-[%i]", _map[c].First(), _map[c].Second());
  22.     }
  23. }
  24.