Reputation: 999
The code I work on is roughly the following:
// 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; }
/* (...) */
};
};
( should the exact code of the above one be needed, please refer to my previous question )
// Matrix.h
#include "List.h"
template <typename T>
class Matrix : List<T> {
/* (...) - some fields */
class element {
supervised_frame<1> *source; // line#15
/* (...) - some methods */
};
};
I get the following error in 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
Upvotes: 1
Views: 142
Reputation: 2108
I believe Matrix<T>::element
class is not related to class List<T>
. So I think you should have typename List<T>::template supervised_frame<1>
.
Upvotes: 2
Reputation: 31952
Similar to your previous problem - Use typename List<T>::supervised_frame<1> *source;
This is because supervised_frame<1>
is a dependant type, i.e it is dependant on the template parameter T
Upvotes: 2