HASH: 去掉next指针以清理更多哈希桶代码
This commit is contained in:
parent
dfcbc2283e
commit
35df7d3e6c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue