我处理的代码大致如下:
// 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; }
/* (...) */
};
};
(如果需要上述代码的确切代码,请参考我之前的问题)
// Matrix.h
#include "List.h"
template <typename T>
class Matrix : List<T> {
/* (...) - some fields */
class element {
supervised_frame<1> *source; // line#15
/* (...) - some methods */
};
};
我在 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