mercredi 3 février 2021

Can we pass self a default parameter in template parameters?

Is there a way to pass the class itself as a default value.

template<typename T, class NodeType>
class A: {
    public:
       virtual NodeType* foo() {}
};
template<typename T, class NodeType=B<T>>
class B: public A<T, NodeType> {
};

I am making a general node for trees.

BinaryTreeNode -> BSTNode -> AVLNode

Aucun commentaire:

Enregistrer un commentaire