Fixes StringViewDictionary::Remove(u32)
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		| @@ -108,7 +108,12 @@ namespace ArbUt { | |||||||
|         inline void Remove(const StringView& key) { _map.erase(key); } |         inline void Remove(const StringView& key) { _map.erase(key); } | ||||||
|  |  | ||||||
|         /// @brief Removes an item with a certain key hash from the dictionary |         /// @brief Removes an item with a certain key hash from the dictionary | ||||||
|         inline void Remove(u32 keyHash) { _map.erase(keyHash); } |         inline void Remove(u32 keyHash) { | ||||||
|  |             auto find = _map.find(keyHash); | ||||||
|  |             if (find != _map.end()) { | ||||||
|  |                 _map.erase(find->first); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|         /// @brief Returns the number of items in the dictionary. |         /// @brief Returns the number of items in the dictionary. | ||||||
|         [[nodiscard]] inline size_t Count() const noexcept { return _map.size(); } |         [[nodiscard]] inline size_t Count() const noexcept { return _map.size(); } | ||||||
|   | |||||||
| @@ -116,6 +116,8 @@ TEST_CASE("Create StringViewDictionary, insert values, get values by hash") { | |||||||
|     dic.Insert("zet"_cnc, 2000); |     dic.Insert("zet"_cnc, 2000); | ||||||
|  |  | ||||||
|     CHECK(dic.GetFromHash("bar"_cnc) == 100); |     CHECK(dic.GetFromHash("bar"_cnc) == 100); | ||||||
|  |     dic.Remove("zet"_cnc.GetHash()); | ||||||
|  |     CHECK(dic.Count() == 2); | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
		Reference in New Issue
	
	Block a user