依赖于类成员属性的类实例成员

我的老师为我提供了一门代表二叉树的课程,我们必须将其用作附件。 所以我正在做一个名为cluster的类,事情像这样:

BinTree(虽然这是最低要求,但我只复制了我的内容):

template <typename T>
class BinTree {
public:

// Constructs an empty tree. Θ(1).
BinTree ()
:   p(nullptr)
{   }

// Constructs a tree with a value x and no subtrees. Θ(1).
explicit BinTree (const T& x);

// Constructs a tree with a value x and two subtrees left and right. Θ(1).
explicit BinTree (const T& x, const BinTree& left, const BinTree& right);

簇:

class Cluster {
    private:

    BinTree<std::pair<std::string, double>> _cluster;

    public:
    Cluster();
    //etc....
}

因为我不能使用继承(我们还没有介绍继承),所以我真的不知道Cluster的构造函数如何。群集对象将是二叉树,但是我以“叶子”开头(英语不是我的第一语言,所以我不知道如何称呼它),因此我必须创建一个字符串,字符串为double double = 0.0。

我假设Cluster构造函数将如下所示:

Cluster(const std::string& id) : _cluster(make_pair(id, 0.0)){};

它是否正确?

然后,将2个特定的群集合并到一个群集中。这个新的集群,因为它的_cluster属性是一个二叉树,将是先前集群的父级,这是我不得不使用BinTree的第三个构造函数,但是我不知道该怎么做。