【发布时间】:2021-06-25 02:54:12
【问题描述】:
我正在尝试为单独链接的向量哈希表创建一个构造函数。我不断收到一条错误消息:
错误:“表”之前的预期主表达式
#include <iostream>
#include <vector>
#include <list>
#include <stdexcept>
// Custom project includes
#include "Hash.h"
// Namespaces to include
using std::vector;
using std::list;
using std::pair;
//
// Separate chaining based hash table - inherits from Hash
//
template<typename K, typename V>
class ChainingHash : public Hash<K,V> {
private:
vector<list<V>> table; // Vector of Linked lists
public:
ChainingHash(int n = 11) {
table = vector<list<K,V>> table(n);
}
【问题讨论】:
标签: c++ vector constructor hashtable