为什么我会得到"end of file found before the left brace '{' in hashtable.h(8)"?
Why do I get "end of file found before the left brace '{' in hashtable.h(8)"?
当我尝试编译时,它会给出该错误,但我不知道为什么,因为两组大括号都匹配。
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <utility>
#include <fstream>
namespace cop4530 {
template <typename T>
class HashTable {
public:
HashTable(size_t size = 101);
~HashTable();
bool contains(const T &);
bool insert(const T &);
bool insert(T && );
bool remove(const T& );
void clear();
bool load(const char *);
void dump();
bool write_to_file(const char *);
// used when improper size is given (for example
// size is 0 or negative)
static const unsigned int default_capacity = 11;
static const unsigned int max_prime = 1301081;
private:
std::vector<std::list<T>> listTab;
void makeEmpty();
void rehash();
size_t myhash(const T &);
unsigned long prime_below(unsigned long);
void setPrimes(std::vector<unsigned long> &);
int currentSize;
}; // end of HashTable
#include "hashtable.hpp"
}; // end of namespace 4530
或者问题可能出在 .hpp 甚至主.cpp?
谢谢!
这里 :
vector<std::list<T>>
>>
是大多数编译器作为运算符读取的标记,如以下行所示:
std::cin >> toto;
它使您的编译器从这一行变得疯狂,并在之后打印奇怪的错误。
插入一个空格以将其定义为双模板括号标记:
vector<std::list<T> >
命名空间
的右括号后没有分号。
相关文章:
- netcat command in c++
- Difference in displaying cv2 Mat
- C++ MFC Libraries in Travis CI
- 如何在OpenSSL中从configuration.h.in获取configuration.h
- 创建具有 new in 函数和"this is nullptr"异常的对象
- IN, OUT, INOUT Parameters
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 有人安装"IITB Simplecpp in mac"吗?
- 从 C 样式字符串中删除子字符串 "in place" 在C++代码中
- 如何修复"error: ‘_1’ was not declared in this scope"?
- Softmax Implementation in C++
- 将 out/in out 参数与 if/switch 的 init 语句一起使用
- IF-nesting in c++
- Gurobi GRBModel and GRBmodel in C++
- Tensorflow Hub in C++
- Centos7 g++ "to_string is not in a member of std"
- InitializeCriticalSectionEx Not Located In KERNEL32.Dll
- 将 lambda 表达式传递给 std::function in C++
- @CPPFLAGS@在 Makefile.in 中意味着什么?
- 为什么我会得到"end of file found before the left brace '{' in hashtable.h(8)"?