template <class V> INFO_ELEMENT<V>::INFO_ELEMENT(unsigned int L)
{
*LENGTH = new unsigned char[1];
LENGTH = (unsigned char)L;
*VALUE = new V[L];
}
template <typename T> struct LIST
{
unsigned char *Length;
T *Value;
public:
LIST(unsigned int L);
};
template <class T> LIST<T>::LIST(unsigned int L)
{
*Length = new unsigned char[1];
Length = (unsigned char)L;
*Value = new T[L];
/*...*/
}
typedef LIST<INFO_ELEMENT>* IR_BIN_DATA;
The error occurs at the last line, where the parametre INFO_ELEMENT passed as the parametre of the instantiation of the class LIST is forbidden. Is is because it expects a type instead of a template.Does anybody know how to solve this issue?
I knew it worked, but I left it blank this way "typedef LIST<INFO_ELEMENT>* IR_BIN_DATA;" because I wanted to encapsulate a generic data type. Is it possible? How could I do it?
template< class T >
class IR_BIN_DATA : public LIST< INFO_ELEMENT< T > >
{
public:
explicit IR_BIN_DATA( unsigned L ) :
LIST< INFO_ELEMENT<T> >( L ) {}
};