我正在尝试创建自己的哈希表以使用我已经创建的链接列表。链接列表位于单独的文件夹中,Codenvy不允许我在头文件中使用它。
我尝试了相对和绝对途径,例如:
#include "../LinkedList/LinkedList.h"
#ifndef HASH_TABLE
#define HASH_TABLE
#include "../LinkedList/LinkedList.h"
template <typename T>
class HashTable {
public:
HashTable(); // Constructor
~HashTable(); // Destructor
void add (T); // add to the corresponding list
protected:
LinkedList<T>[] table; // includes linked lists to carry all data
private:
int hashIndex (T); // Finds the index of an element
};
#endif
我期望c ++允许数组由自定义对象组成,但是我可能很错。错误是:
In file included from Main.cpp:2:0:
HashTable.h:12:22: error: expected unqualified-id before ‘[’ token
LinkedList<T>[] table;
^
答案 0 :(得分:0)
尝试:
<main class="work">
<a href="#">
<section class="logofolio">
<div class="content">
<h2>some stuff</h2>
<h1>Title</h1>
<img src="img/arrow.svg" alt="arrow" width="30">
</div>
</section>
</a>
</main>
请记住:数组的大小必须恒定并且在编译时就知道