C++ c++;:将模板声明为类成员

C++ c++;:将模板声明为类成员,c++,class,templates,C++,Class,Templates,我需要一个节点类来构建树node是一个模板类,其中包含模板参数\u Data和\u Container。为了在模板参数中没有递归,我让\u Container成为一个类的模板类实例。我在node中声明typedef\u Data\u type,并希望像node::Data\u type一样使用node::container\u type。我该怎么办 template< typename _Data, template<typename T> cl

我需要一个
节点
类来构建树
node
是一个模板类,其中包含模板参数
\u Data
\u Container
。为了在模板参数中没有递归,我让
\u Container
成为一个类的模板类实例。我在
node
中声明
typedef\u Data\u type
,并希望像
node::Data\u type
一样使用
node::container\u type
。我该怎么办

template<
    typename
        _Data,
    template<typename T> class
        _Container = std::vector>
struct node
{
    typedef _Data data_type;

    //TODO container_type

    typedef node<_Data, _Container> type;
    typedef std::shared_ptr<type> ptr;
    typedef _Container<ptr> ptrs;
    Data data;
    ptrs children;
};
模板<
类别名
_数据,
模板类
_容器=标准::向量>
结构节点
{
typedef_数据类型;
//TODO容器类型
typedef节点类型;
typedef std::共享\u ptr ptr;
typedef_集装箱PTR;
数据;
ptrs儿童;
};

在C++11中,可以使用以下内容:

template<typename T, template<typename> class Container>
struct node
{
    using data_type = T;

    template <typename U>
    using container_templ = Container<U>;

};
template <typename T>
using My_Vector = std::vector<T>;
template<typename T, template<typename> class Container = My_Vector>
struct node;