Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/145.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 构造函数系列_C++_Constructor - Fatal编程技术网

C++ 构造函数系列

C++ 构造函数系列,c++,constructor,C++,Constructor,我编写了这个节点类: template<class T> struct Node{ Node() : content(), col(RED), parent(0), left(0), right(0) {} Node(const Node& orig) : content(orig.content), col(orig.col), parent(orig.parent), left(orig.left), right(orig.right) {} vi

我编写了这个节点类:

template<class T>
struct Node{
    Node() : content(), col(RED), parent(0), left(0), right(0) {}
    Node(const Node& orig) : content(orig.content), col(orig.col), parent(orig.parent), left(orig.left), right(orig.right) {}
    virtual ~Node() {}
    Node<T>& operator= (const Node<T>& node);
    template <class sT>
    friend std::ostream& operator<<(std::ostream& out,const Node<sT>&node);
    T content;
    Color col;
    Node<T> *parent,*left,*right;
};
模板
结构节点{
Node():content(),col(红色),parent(0),left(0),right(0){}
节点(const Node&orig):内容(orig.content)、列(orig.col)、父级(orig.parent)、左(orig.left)、右(orig.right){}
虚拟~Node(){}
节点和运算符=(常量节点和节点);
模板

friend std::ostream&operator你缺少一个构造函数:
节点(const T&x);
你缺少一个构造函数:
节点(const T&x);
你缺少一个构造函数:
节点(const T&x);
你缺少一个构造函数:
节点(const T&x)

您必须提供一个构造函数签名,如
节点(const T&x);
才能这样做。这是编译器给您的错误,而不是调试器。您必须提供一个构造函数签名,如
节点(const T&x)
才能这样做。这是编译器给你的错误,而不是调试器。你必须提供一个构造函数签名,如
节点(const T&x);
才能这样做。这是编译器给你的错误,而不是调试器。你必须提供一个构造函数签名,如
节点(const T&x)
能够做到这一点。这是编译器给你的错误,而不是调试器。这可以解决语法错误,但从OP的上下文来看,我不知道如何对此进行有意义的实现。(这就是为什么对应该是注释的答案进行不明智的向上投票是不好的!)这将解决语法错误,但从OP的上下文来看,我不知道这是一个有意义的实现(这就是为什么对应该是注释的答案进行无意义的向上投票是不好的!)这将解决语法错误,但从OP的上下文来看,我不知道这是一个有意义的实现。(这就是为什么对应该是注释的答案进行不明智的向上投票是不好的!)这将解决语法错误,但从OP的上下文来看,我不知道如何对此进行有意义的实现。(这就是为什么对应该是注释的答案进行不明智的向上投票是不好的!)
Node<Node< pair<int,char> > > n1 (Node<pair<int,char> >( pair<int,char>(45,'a') ));
main.cpp:31:84: error: no matching function for call to ‘Node<std::pair<int, char> >::Node(std::pair<int, char>)’