Templates and nested classes/structures

后端 未结 2 1610
轮回少年
轮回少年 2021-01-11 22:04

I have a simple container :

template  list {
    public:
        struct node {
            nodeType info;
            node* next;
              


        
2条回答
  •  旧巷少年郎
    2021-01-11 23:01

    You need to tell the compiler that node is a type using the keyword typename.Otherwise it will think node as a static variable in class list. Add typename whenever you use node as a type in your implementation of list.

提交回复
热议问题