template <typename _datTy>
class ANode{
typedef ANode<_datTy> _nodeTy;
public:
std::vector<_nodeTy> childVector;
};
template <typename _datTy, class _nodeTy = ANode>
ATree
{
public :
void doSomeThing()
{
auto iter = _root.childVector.begin();
}
protected:
_nodeTy _root;
};
template <typename _datTy>
class BNode :
public ANode<_datTy>
{
typedef BNode<_datTy> _nodeTy;
public:
bool somethingExtends;
};
template <typename _datTy>
BTree :
public ATree<_datTy, BNode<_datTy>>
{
...
};
BTree<char> test;
test.doSomeThing();
This code problem is std::vector<_nodeTy> childVector. It's translate to std::vector<Anode<_datTy>> on BTree compile time.
But I really want this, std::vector<Anode<_datTy>> on ATree compile time, and std::vector<Bnode<_datTy>> on BTree compile time.
I don't use base class pointer like this std::vector<_nodeTy *>, on current architecture point.
how to any idea this problem? Thanks for your read.
Aucun commentaire:
Enregistrer un commentaire