Does anyone have any insight in to how this error occurs? I made a LinkedList a template in C++ and in my main method I have this code:
List<int> list;
list.insert(1, 9);
And I am getting this error on the first line:
`List' is not a template
I am including this file:
template <typename T>
class List
{
public:
List();
List(const List& aList);
~List();
bool isEmpty() const;
int getLength() const;
void insert(int index, const T& newItem);
void remove(int index);
void retrieve(int index, T& dataItem) const;
private:
struct ListNode
{
T item;
ListNode *next;
};
int size;
ListNode *head;
ListNode *find(int index) const;
};
Not posting the implementation file for spacial reasons but I am post individual functions if necessary.
I tried changing List(const List& aList);
to List(const List<T>& aList);
but that didn't really change anything. Templating syntax confuses me >.<