diff --git a/dlib/util.d b/dlib/util.d index 2259179..c524af8 100644 --- a/dlib/util.d +++ b/dlib/util.d @@ -513,6 +513,11 @@ struct HashTable(K, V) u64 node_count; u64 list_count; + bool opCast(T)() if(is(T == bool)) + { + return cast(bool)this.list_count; + } + void opIndexAssign(V value, K key) { Push(&this, key, value); @@ -618,7 +623,7 @@ Search(K, V)(HashTable!(K, V)* ht, K key) LinkedList!(KVPair!(K, V))* GetList(K, V)(HashTable!(K, V)* ht, K key) { - u64 hash = Hash(&key); + u64 hash = Hash(&key); u64 index = hash % ht.list_count; return ht.lists.ptr + index; }