Use custom key structs, instead of raw hashes for the Label3D and TextMesh, to avoid potential hash collisions.

This commit is contained in:
bruvzg
2022-06-18 16:14:08 +03:00
parent 5b3b06187b
commit 329923c6ac
5 changed files with 65 additions and 31 deletions

View File

@ -35,7 +35,7 @@
#include "hash_map.h"
#include "list.h"
template <class TKey, class TData>
template <class TKey, class TData, class Hasher = HashMapHasherDefault, class Comparator = HashMapComparatorDefault<TKey>>
class LRUCache {
private:
struct Pair {
@ -52,7 +52,7 @@ private:
typedef typename List<Pair>::Element *Element;
List<Pair> _list;
HashMap<TKey, Element> _map;
HashMap<TKey, Element, Hasher, Comparator> _map;
size_t capacity;
public: