c++ - 错误信息 C++

标签 c++ b-tree

我在尝试编译我的代码时收到此错误消息:

btree.h:23: error: expected unqualified-id before 'template'

它来自这一行:

template <typename T> std::ostream& operator<<(std::ostream& os, const btree<T>& tree);

除了一堆评论和一些 #include 之外,这条线之上绝对没有任何东西。库文件,它们是:

#include <iostream>
#include <cstddef>
#include <utility>

#include "btree_iterator.h"

我的 btree_iterator.h 包含:

template <typename T>
class btree_iterator  {


}

如果有人能告诉我哪里出了问题,我们将不胜感激!

最佳答案

你忘了分号:

template <typename T>
class btree_iterator  {


};
 ^

关于c++ - 错误信息 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7789108/

相关文章:

B-tree minimum internal children count 解释

c++ - 您能否仅使用标准 c++/c++11 实现没有 "sleep"的计时器?

c++ - c++ ("cin"语句中的 I/O 异常问题)

c++ - 来自 vector 的 glDrawArrays 和 GL_LINE_STRIP 的折线图

c++ - 如何使用 MinGW 将符号正确导出到 Windows DLL 中?

mysql - InnoDB B+ 树索引 - 重复值

mongodb - 为什么不用B+-Tree MongoDB

c++ - 元组 vector 和 initializer_list

java - B树和磁盘持久性

c - 调用函数后指向 B 树根节点的指针开始指向子节点(应该继续指向根节点)