C++ 继承类中嵌套类的可见性

C++ 继承类中嵌套类的可见性,c++,templates,inheritance,visibility,nested-class,C++,Templates,Inheritance,Visibility,Nested Class,我研究的代码大致如下: // List.h template <typename T> class List{ template <typename TT> class Node; Node<T> *head; /* (...) */ template <bool D> class iterator1{ protected: Node<T> this->n; publ

我研究的代码大致如下:

// List.h
template <typename T> class List{
    template <typename TT> class Node;
    Node<T> *head;
    /* (...) */
    template <bool D> class iterator1{
        protected: Node<T> this->n;
        public: iterator1( Node<T> *nn ) { n = nn }
        /* (...) */
    };
    template <bool D> class iterator2 : public iterator1<D>{
        public:
        iterator2( Node<T> *nn ) : iterator1<D>( nn ) {}
        void fun( Node<T> *nn ) { n = nn; }
        /* (...) */
    };
};
如果需要上述代码,请参阅我的

我在g++中遇到以下错误:

 In file included from main.cpp:2:
 Matrix.h:15: error: ISO C++ forbids declaration of ‘supervised_frame’ with no type
 Matrix.h:15: error: expected ‘;’ before ‘<’ token

我相信Matrix::element类与类列表无关。所以我认为您应该有typename List::template受监督的框架。

我认为Matrix::element类与类列表无关。因此,我认为您应该使用typename List::template supervised_frame。

类似于您之前的问题-使用typename List::supervised_frame*source;这是因为受监督的_框架是一种依赖类型,即它依赖于模板参数T

,类似于您之前的问题-使用typename List::受监督的_框架*源;这是因为监督帧是一种依赖类型,即它依赖于模板参数T

这里没有足够的代码来确定错误。不过,猜测一下,您需要转发一个框架。@Yuushi请参考提供的链接。我在上面的代码中包含了List.h,其中定义了监督框架。谁对这个问题投了赞成票,为什么?这完全是无稽之谈@infoholic_anonymous:请看;让你需要帮助的人做所有的工作是没有成效的。@ildjarn这个标题在我看来非常清楚。“不过,他真的应该给列表加上一个简短的定义。”Pubby谢谢你的评论,我已经按照你的建议做了。这里没有足够的代码来指出错误。不过,猜测一下,您需要转发一个框架。@Yuushi请参考提供的链接。我在上面的代码中包含了List.h,其中定义了监督框架。谁对这个问题投了赞成票,为什么?这完全是无稽之谈@infoholic_anonymous:请看;让你需要帮助的人做所有的工作是没有成效的。@ildjarn这个标题在我看来非常清楚。“不过,他真的应该给列表加上一个简短的定义。”谢谢你的评论,我已经做了你所做的suggested@infoholic_anonymous,好的,那么我想它应该是typename List::template-supervised\u-frame。这是为了让编译器知道第二个@infoholic_匿名,好吧,那么我认为它需要是typename List::template-supervised_-frame。这是为了让编译器知道
 In file included from main.cpp:2:
 Matrix.h:15: error: ISO C++ forbids declaration of ‘supervised_frame’ with no type
 Matrix.h:15: error: expected ‘;’ before ‘<’ token