#include
using namespace std;
template
struct Node{
Node(T &d):c(d),next(0),pref(0){
T c;
Node *next,*pref;
}
};
template
class List{
Nodefirst, *last;
public:
List();
void add(T& c);
void remove(T& c);
Node find(T& c);
void print();
~List();
};
template
List::List():first(0),last(0){}
template
void List::add(T& n)
{
Node *p=new Node(n);
p->next=first;
first=p;
(last?p->next->pref:last)=p;
}
template
Node*List::find(T& n)
{
for(Node*p=first;p;p->next)
if(p->c==n)
return p;
return 0;
}
template
List::~List()
{
for(Node* p=first;p;p=p->next)
first=first->next;
}
template
void List::print(){
for(Node*p=first;p;p=p->next)
cout<c<<" ";
cout<<"\n";
}
int main(){
List dlist;
double a=3.6,b=5.8;
dlist.add(a);
dlist.add(b);
dlist.print();
}
error C2039: 'next' : is not a member of 'Node'
while compiling class-template member function 'void __thiscall List::add(double &)'