从这里实例化
Instantiated from here
我有一个问题"从这里实例化"。
template <typename E>
class tree
{
public:
tree(){root=0;}
void addAVL( const E &data) throw(bad_alloc);
private:
class Node
{
public:
E data;
Noeud * left;
Noeud * right;
int high;
std::string adHier;
Noeud( const E&d ): data( d right( 0 ),left( 0 ),high(0), adHier("") { }
};
Node * root;
};
#include "AVL.inl"
/*-------------------------
*in my inl
*/
template <typename E>
void tree<E>::addAVL( const E &data) throw(bad_alloc)
{
// if the trre is empty
if ( root == 0 )
{
root = new Node(data); // HERE my error when in a cpp I call addAVL
}
}
我的错误是:
../AVL.inl:98: instantiated from ‘void AVL_Lab10::tree<E>::addAVL(const E&) [with E = int]’
../TestingAVL.cpp:30: instantiated from here
Noeud * left;
Noeud * right;
Noeud( const E&d ): ...
我猜应该是Node
而不是Noeud
?如果你改正了这些错别字,它能纠正你的错误吗?
最后我没有找到问题,但我可以构建…我的老师告诉我,他在eclipse中的GCC编译器也有同样的问题。这很奇怪,因为每次我在我的。inl中添加一些代码并保存。错误图标显示....
谢谢你的帮助!: D
相关文章:
- 从C++实例化QML
- 设计一个只能由特定类实例化的类(如果可能的话,通过make_unique)
- 如何创建一个空的全局类并在启动时实例化它
- 在两个类中共享相同的函数调用,并在不需要时避免空实例化
- 约束和显式模板实例化
- 为什么包含windows.h会产生语法错误,从而阻止类的实例化?(C2146,C2065)
- 对象实例化调用构造函数的次数太多
- 如何使用非默认构造函数实例化模板化类
- 静态数据成员模板专用化的实例化点在哪里
- 错误的cv::face FacemarkLBF实例化
- C++的解析器在可以区分比较和模板实例化之前会做什么?
- 为什么 gcc 和 clang 为函数模板的实例化生成不同的符号名称?
- 检查某些类型是否是模板类 std::optional 的实例化
- 使用大括号实例化 - 它是什么,为什么在这里使用它?
- 为什么模板实例化永远在这里
- 类从这里实例化错误c++
- 什么是“在实例化...需要从这里“的意思
- 使用模板时从这里实例化的c++错误
- 从这里实例化错误
- 从这里实例化