Mình đang tạo một thư viện cho danh sách liên kết thì bi lỗi :" no instance of function template matches the argument list. giúp mình fix lỗi này vs ạ
#ifndef _LISH_H
#define _LISH_H
using namespace std;
#include<iostream>
#include<stdlib.h>
#include<malloc.h>
template<class T>
struct node
{
T key;
node* next;
};
template <class T>
void insertFirst( node<T>* &head, T x)
{
node<T> *tam=head;
node<T>* newnode=new node<T>;
if(newnode==NULL)
{
exit(0);
}
newnode->next=NULL;
newnode->key=x;
head=newnode;
newnode->next=tam;
}
template <class T>
void freelish(node<T> *&head)
{
node<T>*p=head;
while(p!=NULL)
{
node<T>*tap=p->next;
delete p;
p=tam;
}
head=NULL;
}
template<class T>
node<T> *gettail(node<T>*&head)
{
node<T>*p=head,*tail=NULL;
while(p!=NULL)
{
tail=p;
p=pnext;
}
return tail;
}
template<class T>
void insertLast(node<T>*head,T x)
{
node<T>* newnode=new node<T>;
if(newnode==NULL)
{
exit(0);
}
newnode->key=x;
newnode->=NULL;
node<T>*tail=gettail();
if(tail=NULL)
head=newnode;
else
tail->next=newnode;
}
#endif