From 35df7d3e6cb7e23577334f801d33cae062e37088 Mon Sep 17 00:00:00 2001 From: CalciteM Team Date: Sun, 14 Jul 2019 20:11:53 +0800 Subject: [PATCH] =?UTF-8?q?HASH:=20=E5=8E=BB=E6=8E=89next=E6=8C=87?= =?UTF-8?q?=E9=92=88=E4=BB=A5=E6=B8=85=E7=90=86=E6=9B=B4=E5=A4=9A=E5=93=88?= =?UTF-8?q?=E5=B8=8C=E6=A1=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NineChess/src/HashNode.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/NineChess/src/HashNode.h b/NineChess/src/HashNode.h index 63df49f9..a3c5a7e8 100644 --- a/NineChess/src/HashNode.h +++ b/NineChess/src/HashNode.h @@ -11,20 +11,31 @@ namespace CTSL //Concurrent Thread Safe Library class HashNode { public: - HashNode() : next(nullptr) + HashNode() +#ifndef DISABLE_HASHBUCKET + : next(nullptr) +#endif {} - HashNode(K key_, V value_) : next(nullptr), key(key_), value(value_) + HashNode(K key_, V value_) : +#ifndef DISABLE_HASHBUCKET + next(nullptr), +#endif + key(key_), value(value_) {} ~HashNode() { +#ifndef DISABLE_HASHBUCKET next = nullptr; +#endif } const K& getKey() const {return key;} void setValue(V value_) {value = value_;} const V& getValue() const {return value;} +#ifndef DISABLE_HASHBUCKET HashNode *next; //Pointer to the next node in the same bucket +#endif private: K key; //the hash key V value; //the value corresponding to the key