构造器系列

The serie of constructors

我写了这个节点class:

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;
};

现在我将在 std::pair 的节点内创建一个节点对象,我写了这个:

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>)’

获得我想要的内容的确切语法是什么?

您缺少构造函数:Node(const T& x);