class template and operator=()
Hey all, I'm working on a general (hopefully very useful) list class template. At the moment I'm stuck with dev-cpp giving me weird errors about my operator=() function:
Code:
template<class item_t>
mylist& mylist<item_t>::operator=(const mylist list2) {
mylist list1;
list1.length = list2.length;
int i;
delete [] list1.list;
list1.list = new item_t[list2.length];
for (i = 0; i < list1.length; ++i)
list1.list[i] = list2.list[i];
return list1;
}
I'm not real familiar with templates so this is probably something super basic and obvious, but any help would be greatly appreciated, thx.