I'm writing a program that needs a SkipList that I wrote a while back, but now I need it templated because it needs to use a custom class that I created. The problem I have is with creating the node in the List class. I use template <class t>
on all my methods but I think that since both the node and the SkipList class use template <class t>
, the same class t
s interfere with each other or something.
In my SkipList.h, I have the method saying
Node <t>* createnode<t>(t,int);
And in the SkipList.cpp, the method says
template <class t>
Node<t>* SkipList<t>::createnode(t value, int level) {
Node<t> *n = new Node<t>(value, level);
return n;
}
This gives me an error in the .h file that says Template specialization requires 'template<>'
, and when I add it in, it replaces the code to say
template<> Node<t>* createnode<t>(t,int);
But then my .cpp file says that there is no function definition anymore.
Does anyone know where I'm going wrong or what I'm missing? Thanks a ton for the help. My GitHub is here if anyone needs it for clarification