Reputation: 3131
Is the following possible :
template<class Container>
class TreeNode
{
Container mChildren;
}
TreeNode<std::vector<boost::shared_ptr<TreeNode>> myTreeNode;
Upvotes: 0
Views: 419
Reputation: 1391
Not like you did. TreeNode is not a class but a class template. I am in a hurry now so this might not be the most simple or elegant way, but it is possible:
#include <vector>
using namespace std;
class Container {};
template<class Container>
class TreeNode
{
Container mChildren;
};
class TreeNodeWrapper;
typedef TreeNode<std::vector<TreeNodeWrapper*> > recursiveTreeNode;
class TreeNodeWrapper : public recursiveTreeNode {
};
recursiveTreeNode myTreeNode;
Upvotes: 2