我试图通过删除旧表并创建一个具有相同内容的新的更大的表来重新表格.我创建了一个reHash函数,但是这个函数会导致内存泄漏,导致程序在执行函数时崩溃.我找不到我的错误.
void HashMap::reHash()
{
int OldCapacity = cap;
cap = cap * 2 + 1; //set new capacity
Node** newHashTable = new Node*[cap]; //create a temporary table to hold info
for (int i = 0; i < cap; i++)
{
    newHashTable[i] = nullptr;
}
const Node* n;
//fill in the new temp table with old info
for (int i = 0; i < OldCapacity; ++i)
{
    n = HashTable[i];
    while (n != nullptr)
    {
        //initialize new node
        Node* nod = …Typename是什么意思?该函数应该返回什么?
typename BSTMap<KEY,T>::TN* BSTMap<KEY,T>::find_key (TN* root, const KEY& key) const {..}