Okay, I'm back again. I moved everything over to the .h file and that made things a lot easier. I'm still using class, I will change that soon. But my next question is about the test() function. I can't add anything. I'm using:
Code:
void test()
{
cout<<"Starting Linked List Test"<<endl;
LinkedList<string> list;
list.Clear();
list.Insert(string("1st"), NULL);
}
the Insert looks like:
Code:
LLNode<T> * Insert(const T* v, LLNode<T> * n)
{
LLNode<T> *newNode = NULL;
if(n==NULL)
{
newNode= new LLNode<T>(v,NULL, LLRoot);
if(LLRoot==NULL)
LLRoot=newNode;
else
LLRoot->prev=newNode;
LLRoot=newNode;
}
else
{
newNode = new LLNode<T>(v,n,n->next);
if(n->next!=NULL)
n->next->prev=newNode;
n->next=newNode;
}
size++;
return newNode;
}
And it gives me the error:
inc/LinkedList.h:312: error: no matching function for call to ‘LinkedList<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Insert(std::string&, NULL)’
inc/LinkedList.h:226: note: candidates are: LLNode<T>* LinkedList<T>::Insert(const T*, LLNode<T>*) [with T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]
I'm sorry about all the questions. I've never tried to do a templated class before! Thanks for the help everyone!