I'm having a curious issue, and I'm not quite sure what the issue is. I'm creating a class called LinkedArrayList that uses a typename template, as shown in the code below:
#pragma once template class LinkedArrayList { private: class Node { ItemType* items; Node* next; Node* prev; int capacity; int size; }; Node* head; Node* tail; int size; public: void insert (int index, const ItemType& item); ItemType remove (int index); int find (const ItemType& item); };
Now, this doesn't give any errors or problems. However, creating the functions in the .cpp file gives me the error "Argument list for class template 'LinkedArrayList' is missing." It also says that ItemType is undefined. Here is the code, very simple, in the .cpp:
#include "LinkedArrayList.h" void LinkedArrayList::insert (int index, const ItemType& item) {} ItemType LinkedArrayList::remove (int index) {return ItemType();} int find (const ItemType& item) {return -1;}
It looks like it has something to do with the template, because if I comment it out and change the ItemTypes in the functions to ints, it doesn't give any errors. Also, if I just do all the code in the .h instead of having a separate .cpp, it works just fine as well.
Any help on the source of the problem would be greatly appreciated.
Thanks.