Bladeren bron

More utility methods

Brian Fiete 6 maanden geleden
bovenliggende
commit
35779edc14
1 gewijzigde bestanden met toevoegingen van 17 en 2 verwijderingen
  1. 17 2
      BeefySysLib/util/MultiDictionary.h

+ 17 - 2
BeefySysLib/util/MultiDictionary.h

@@ -117,12 +117,12 @@ public:
 			return *this; // At end
 		}
 
-		TKey GetKey()
+		TKey& GetKey()
 		{
 			return this->mDict->mEntries[this->mCurEntry].mKey;
 		}
 
-		TValue GetValue()
+		TValue& GetValue()
 		{
 			return this->mDict->mEntries[this->mCurEntry].mValue;
 		}
@@ -466,6 +466,21 @@ public:
 		}
 
 		return end();
+	}	
+
+	template <typename TKey>
+	bool Contains(const TKey& key)
+	{
+		return TryGet(key) != end();
+	}
+
+	template <typename TKey>
+	int GetCount(const TKey& key)
+	{
+		int count = 0;
+		for (auto itr = TryGet(key); itr != end(); ++itr)
+			count++;
+		return count;
 	}
 
 	template <typename TKey>