This question already has an answer here:
just tell me why it is not possible to use struct of template class in another template class. i personally think it is logical. have c++ such feature? I'm using VS 2015. thanks :)
template<typename T> class MyList
{
public:
struct Node
{
T value;
Node* next;
};
//...
};
template<typename Type> class MyMap
{
public:
struct ElementData
{
Type types[32];
unsigned key;
};
MyList<ElementData>::Node* nodes; //Syntax Error: Identifier 'Node'
};
while this works.
template <typename T> struct Node
{
T value;
Node* next;
};
template<typename T> class MyList
{
public:
Node<T>* root;
//...
};
template<typename Type> class MyMap
{
public:
struct ElementData
{
Type types[32];
unsigned key;
};
Node<ElementData>* nodes;
};
Aucun commentaire:
Enregistrer un commentaire