为什么我会得到"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)"?

本文关键字:in hashtable brace left end of the before found file 为什么      更新时间:2023-10-16

当我尝试编译时,它会给出该错误,但我不知道为什么,因为两组大括号都匹配。

   #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> >
命名空间

的右括号后没有分号。